Last active
July 22, 2023 14:07
-
-
Save SaikumarKonakanchi0/2a9afdc66de0aac9e6aed93f951820b7 to your computer and use it in GitHub Desktop.
DS060623_CodeWar_1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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