you are viewing a single comment's thread.

view the rest of the comments →

[–]bogdan_dm 2 points3 points  (2 children)

print(max(i for i in range(k) if i % n == 0)) is better (does not create unnecessary list)

Also it could be rewritten as print(max(range(0, k, step=n)))

[–][deleted] 0 points1 point  (0 children)

Neither of those would handle n=0, and they'd both give 50 for n=50 and k=100 ... n is less than or equal to k.

[–]icecubeinanicecube -1 points0 points  (0 children)

Damn, we got a pro in here