in my current zybooks lab 3.13 the assignment asks to "Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies."
When I submit my work I am receiving '0/2' on 2 requirements. I need to figure out how to make it stop outputting 'No change' if there is a '0' in the integer. HALP!!!!!
here is my code:
user_input = int(input())
# Conditional math Block: Used to determine user input value in amount of dollars, quarters, dimes, nickles and pennies.
dollar = user_input // 100 # convert to dollars
user_input %= 100 # remainder after conversion
quarter = user_input // 25 # convert to quarters
user_input %= 25 # remainder after conversion
dime = user_input // 10 # convert to dimes
user_input %= 10 # remainder after conversion
nickel = user_input // 5 # convert to nickels
user_input %= 5 # remainder after conversion
penny = user_input
# Determines if user input is invalid.
if user_input <= 0:
print('No change')
# Condition Block: Analyzes user input and assigns appropriate values.
if dollar > 1: # Uses math block to determine if user input is equivalent to more than 1 Dollar.
print(dollar, 'Dollars')
elif dollar == 1: # Uses math block to determine if user input is equivalent to 1 Dollar.
print(dollar, 'Dollar')
if quarter > 1: # Uses math block to determine if user input is equivalent to more than 1 Quarter.
print(quarter, 'Quarters')
elif quarter == 1: # Uses math block to determine if user input is equivalent to 1 Quarter.
print(quarter, 'Quarter')
if dime > 1: # Uses math block to determine if user input is equivalent to more than 1 Dime.
print(dime, 'Dimes')
elif dime == 1: # Uses math block to determine if user input is equivalent to 1 Dime.
print(dime, 'Dime')
if nickel > 1: # Uses math block to determine if user input is equivalent to more than 1 nickel.
print(nickel, 'Nickels')
elif nickel == 1: # Uses math block to determine if user input is equivalent to 1 nickel.
print(nickel, 'Nickel')
if penny > 1: # Uses math block to determine how many Pennies' user input is equivalent to.
print(penny, 'Pennies')
elif penny == 1: # Uses math block to determine how many Pennies' user input is equivalent to.
print(penny, 'Penny') ```