Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def is_palindrome(string):
- if len(string)<2:
- return True
- elif string[0] == string[-1]:
- return is_palindrome(string[1:-2])
- return False
- print(is_palindrome("Rupesh"))
- def decimal_to_binary(num):
- if num == 0:
- return "0"
- else:
- return decimal_to_binary(num//2) + str(num%2)
- print(decimal_to_binary(1202))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement