Sep-16-2017, 12:05 AM
There is the % operation (modulo operator) in python, do you have the right to use it?
Using the / operator on integers to get how much times you have the second number fitting in the first, and then having the modulo to know how much money you can try with the next one is a more elegant way to do this, I let you figure out how.
Using the / operator on integers to get how much times you have the second number fitting in the first, and then having the modulo to know how much money you can try with the next one is a more elegant way to do this, I let you figure out how.
>>> 103%25 3 >>> 5 / 2 2Alternatively, you can do this with while loops, but make sure you have finished to fit in all the quartets before you get to the next one. It can be cleaner to have a separate loop for each, or make use of a for loop to get the right amount of iterations without having to bother with "while true" stuff
>>> a = [25, 10, 5, 1] >>> for value in a: ... print value ... 25 10 5 1 >>>