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
# edyoda code war 3rd question | |
def is_palindrome(n): | |
# Convert the number to a string | |
num_str = str(n) | |
# Check if the string is equal to its reverse | |
if num_str == num_str[::-1]: | |
return "Yes" |
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
# edyoda code war 2nd | |
def isDigitSumPalindrome(N): | |
def get_digit_sum(number): | |
# Calculate the sum of digits of the number | |
digit_sum = 0 | |
while number > 0: | |
digit_sum += number % 10 | |
number //= 10 | |
return digit_sum |
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
# python code for edyoda code war 1st question | |
def sum(arr, n): | |
total_sum = 0 | |
for i in range(n): | |
total_sum += arr[i] | |
return total_sum | |
# Example 1 |