r/code • • Sep 12 '23
Help Please Help
The x+ y is not being run in the code and is being skipped, any help with mean a lot
3
Upvotes
r/code • • Sep 12 '23
The x+ y is not being run in the code and is being skipped, any help with mean a lot
View all comments
Show parent comment
1
u/Fradeknott Sep 25 '23
is there such a thing as a 6s coin? assuming we ignore errors and exceptions. shouldn't it look more like this?
print("amount due:", 50)
n = int(input("insert coin: "))
total = 50
while total > 0:
if n == 5:
total = total - 5
elif n == 10:
total = total - 10
elif n == 25:
total = total - 25
if total <= 0:
print("change owed", 0 - total)
break
print("amount owed", total)
n = int(input("insert coin: "))
continue
just my 2 cents.