Guest User

Untitled

a guest
Dec 18th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import math
  2.  
  3. a, b = map(int, input().split())
  4. x, l, r = map(int, input().split())
  5.  
  6. #u = [list(range(a, b))]
  7.  
  8. def divide(a,b,x):
  9. return list(range((math.floor(a/x)+1)*x,b,x))
  10.  
  11. def count(li):
  12. total = 0
  13. for number in li:
  14. for digit in str(number):
  15. total += int(digit)
  16. return total
  17.  
  18. def count_to_single(num):
  19. while num>9:
  20. num = sum(int(i) for i in str(num))
  21. return num
  22.  
  23. print(count_to_single(count(divide(a, b, x))))
Add Comment
Please, Sign In to add comment