Guest User

Untitled

a guest
Apr 21st, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. def print_table(n):
  2. for x in range(1,n+1):
  3. tot = 0
  4. for y in range(1,x):
  5. if x%y == 0:
  6. tot+=y
  7. if x == 1:
  8. print x, 'is perfect'
  9. elif tot < x:
  10. print x, 'is deficient'
  11. elif tot == x:
  12. print x, 'is perfect'
  13. elif tot > x:
  14. print x, 'is abundant'
  15. number = int(raw_input("Enter a number: "))
  16. print_table(number)
Add Comment
Please, Sign In to add comment