in this video(at 7min30seconds), the code bellow I copied from this video returns 3, although mine returns 4.04. I do not understand why codes in the video returns Int, though mine returns Float.
https://www.youtube.com/watch?v=HWW-jA6YjHk&list=UUNc-Wa_ZNBAGzFkYbAHw9eg&index=29
def num_coins(cents):
if cents < 1:
return 0
coins = [25, 10, 5, 1]
num_of_coins = 0
for coin in coins:
num_of_coins += cents / coin
cents = cents % coin
if cents == 0:
break
return num_of_coins
print(num_coins(31))