Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. n = 1
  2.  
  3. while True:
  4.     lst = [int(i) for i in str(n)]
  5.     lst2 = [int(i) for i in str(n**2)]
  6.     if sum(lst) == sum(lst2):
  7.         print "winner"
  8.         print n
  9.         print n**2
  10.         print "Sum:", sum(lst), sum(lst2)
  11.         print ""
  12.         n += 1
  13.     else:
  14.         n += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement