I need help with my code. (Using vscode) I'm new to coding and thought a change calculator would be cool to make. So, after I made one, I ran into a problem.
The hundreds, fifties, twenties, tens, fives, and ones all work fine but when I try decimals like .03, my code just doesn't respond. Please help me. Here is the code.
Change = float(input('Change: '))
Hundreds, Fifties, Twenties, Tens, Fives, Ones = [0,0,0,0,0,0]
Quarters, Dimes, Nickels, Pennies = [0,0,0,0]
_ = True
while _:
if Change <= 0:
_ = False
elif Change - 100 >= 0:
Hundreds += 1
Change -= 100
elif Change - 50 >= 0:
Fifties += 1
Change -= 50
elif Change - 20 >= 0:
Twenties += 1
Change -= 20
elif Change - 10 >= 0:
Tens += 1
Change -= 10
elif Change - 5 >= 0:
Fives += 1
Change -= 5
elif Change - 1 >= 0:
Ones += 1
Change -= 1
elif Change - .25 >= 0:
Quarters += 1
Change -= .25
elif Change - .10 >= 0:
Dimes += 1
Change -= .10
elif Change - .05 >= 0:
Nickels +=1
Change -= .05
elif Change - .01 >= 0:
Pennies += 1
Change -= .01
Currency = [Hundreds, Fifties, Twenties, Tens, Fives, Ones, Quarters, Dimes, Nickels, Pennies]
ids = ['Hundreds: ', 'Fifties: ', 'Twenties: ', 'Tens: ', 'Fives: ', 'Ones: ', 'Quarters: ', 'Dimes: ', 'Nickels: ', 'Pennies: ']
print('')
for l in range(10):
if Currency[l-1] > 0:
print(ids[l-1] + str(Currency[l-1]))
print('')