Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- a, b = map(int, input().split())
- x, l, r = map(int, input().split())
- #u = [list(range(a, b))]
- def divide(a,b,x):
- return list(range((math.floor(a/x)+1)*x,b,x))
- def count(li):
- total = 0
- for number in li:
- for digit in str(number):
- total += int(digit)
- return total
- def count_to_single(num):
- while num>9:
- num = sum(int(i) for i in str(num))
- return num
- print(count_to_single(count(divide(a, b, x))))
Add Comment
Please, Sign In to add comment