Advertisement
RupeshAcharya60

Restart 1

Aug 26th, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. def is_palindrome(string):
  2.     if len(string)<2:
  3.         return True
  4.     elif string[0] == string[-1]:
  5.         return is_palindrome(string[1:-2])
  6.        
  7.     return False
  8.    
  9.    
  10. print(is_palindrome("Rupesh"))
  11.    
  12.    
  13. def decimal_to_binary(num):
  14.     if num == 0:
  15.         return "0"
  16.     else:
  17.         return decimal_to_binary(num//2) + str(num%2)
  18.        
  19. print(decimal_to_binary(1202))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement