Guest User

Untitled

a guest
Aug 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. Is there any interactive programming language where 1.0 is an integer?
  2. def five():
  3. a = 0
  4. b = 0
  5. c = 0
  6. while a <= 9:
  7. a = a + 1
  8. b = a / 5
  9. if type(b) == int and b is not 0:
  10. c = c + 1
  11. else:
  12. pass
  13. print c
  14.  
  15. if a % 5 == 0:
  16. c = c + 1
  17.  
  18. def five():
  19. count = 0
  20. for i in range(1, 10):
  21. if i%5 == 0:
  22. count += 1
  23. print (count, end='')
  24.  
  25. count = 0
  26. for i in range(1,10):
  27. if i % 5 == 0:
  28. count += 1
  29. print count
  30.  
  31. >>> (1.0).is_integer()
  32. True
  33. >>> (1.1).is_integer()
  34. False
  35.  
  36. sum([0 if x%5 else 1 for x in range(1,10)])
Add Comment
Please, Sign In to add comment