Skip to content

Instantly share code, notes, and snippets.

@SaikumarKonakanchi0
Last active July 22, 2023 14:07
Show Gist options
  • Save SaikumarKonakanchi0/2a9afdc66de0aac9e6aed93f951820b7 to your computer and use it in GitHub Desktop.
Save SaikumarKonakanchi0/2a9afdc66de0aac9e6aed93f951820b7 to your computer and use it in GitHub Desktop.
DS060623_CodeWar_1
def sum(arr,n):
total_sum=0
for i in range(0,n):
total_sum+=arr[i]
return total_sum
#returns the sum of the array
def isDigitSumPalindrome(n):
sum=0
while n>0:
sum+=n%10
n//=10
str_sum=str(sum)
if str_sum==str_sum[::-1]:
return 1
else:
return 0
#Retruns 1 is the sum of number is palindrome else returns 0
def is_palindrome(n):
str_n=str(n)
if str_n==str_n[::-1]:
return 'Yes'
else:
return 'No'
# returns Yes if number is palindrome else returns No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment