Advertisement
Guest User

x04ty29er

a guest
Sep 25th, 2009
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. def reverse(num):
  2.     temp = num
  3.     rev_num = 0
  4.     while temp > 0:
  5.         rev_num *= 10
  6.         rev_num += temp%10
  7.         temp /= 10
  8.     return rev_num
  9.  
  10. def ispalindrome(num):
  11.     if num == reverse(num):
  12.         return True
  13.     else:
  14.         return False
  15. def main():
  16.     test_bool = True
  17.     test_num = 0
  18.     test_cube = test_num**3
  19.     while test_bool:
  20.         test_num += 1
  21.         test_cube = test_num**3
  22.         if not ispalindrome(test_num) and ispalindrome(test_cube):
  23.             test_bool = False
  24.  
  25.     print test_num
  26. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement