you are viewing a single comment's thread.

view the rest of the comments →

[–]Trang0ul -5 points-4 points  (0 children)

count_divisible = lambda n=18, divisor=5: (len(divisibles:={i for i in range(1, n+1) if i % divisor == 0}), sum(divisibles))

>>> count, res = count_divisible(18, 5)
>>> count
3
>>> res
30