Respuesta :
Answer:
amount = int(input())
#Check if input is less than 1
if amount<=0:
print("No change")
else: #If otherwise
#Convert amount to various coins
dollar = int(amount/100) #Convert to dollar
amount = amount % 100 #Get remainder after conversion
quarter = int(amount/25) #Convert to quarters
amount = amount % 25 #Get remainder after conversion
dime = int(amount/10) #Convert to dimes
amount = amount % 10 #Get remainder after conversion
nickel = int(amount/5) #Convert to nickel
penny = amount % 5 #Get remainder after conversion
#Print results
if dollar >= 1:
if dollar == 1:
print(str(dollar)+" Dollar")
else:
print(str(dollar)+" Dollars")
if quarter >= 1:
if quarter == 1:
print(str(quarter)+" Quarter")
else:
print(str(quarter)+" Quarters")
if dime >= 1:
if dime == 1:
print(str(dime)+" Dime")
else:
print(str(dime)+" Dimes")
if nickel >= 1:
if nickel == 1:
print(str(nickel)+" Nickel")
else:
print(str(nickel)+" Nickels")
if penny >= 1:
if penny == 1:
print(str(penny)+" Penny")
else:
print(str(penny)+" Pennies")
Explanation:
The first answer is almost right, but this should give you the complete answer with the proper starting point and correct capitalizations.
The program is an illustration of conditional statements.
Conditional statements are statements whose execution depends on its truth value.
The program in Python, where comments are used to explain each line is as follows:
#This gets input for the amount
amount = int(input("Enter Amount: "))
#This checks if the amount is less than 1
if amount<=0:
print("No Change")
else: #If otherwise
#The next lines convert amount to various coins
dollar = int(amount/100) #Convert to dollar
amount = amount % 100 #Get remainder after conversion
quarter = int(amount/25) #Convert to quarters
amount = amount % 25 #Get remainder after conversion
dime = int(amount/10) #Convert to dimes
amount = amount % 10 #Get remainder after conversion
nickel = int(amount/5) #Convert to nickel
penny = amount % 5 #Get remainder after conversion
#The following if statements print the change
#The prints dollars
if dollar >= 1:
if dollar == 1:
print(str(dollar)+" dollar")
else:
print(str(dollar)+" dollars")
#The prints quarters
if quarter >= 1:
if quarter == 1:
print(str(quarter)+" quarter")
else:
print(str(quarter)+" quarters")
#The prints dimes
if dime >= 1:
if dime == 1:
print(str(dime)+" dime")
else:
print(str(dime)+" dimes")
#The prints nickels
if nickel >= 1:
if nickel == 1:
print(str(nickel)+" nickel")
else:
print(str(nickel)+" nickels")
#The prints pennies
if penny >= 1:
if penny == 1:
print(str(penny)+" penny")
else:
print(str(penny)+" pennies")
Read more about similar programs at:
https://brainly.com/question/16839801