Nov-14-2019, 07:55 PM
Is there any way to convert a list of integers to a list of strings?
Below is a program that asks the user how much he paid for the food and the program calculates the returned change.
I want the output to be for example [500 note, 200 note, 10 coin, 1 coin]. The notes and coins are in SWE if it seems unfamiliar ;)
Below is a program that asks the user how much he paid for the food and the program calculates the returned change.
I want the output to be for example [500 note, 200 note, 10 coin, 1 coin]. The notes and coins are in SWE if it seems unfamiliar ;)
price = int(input('What is the price for the food? ')) paid = int(input('How much did you pay for it? ')) change = paid - price cash = [500, 200, 100, 50, 20, 10, 5, 2, 1] changeReturned = [] for i in cash: while change >= i: changeReturned.append(i) change = change - i print(changeReturned)