Welcome to Westonci.ca, your go-to destination for finding answers to all your questions. Join our expert community today! Our platform offers a seamless experience for finding reliable answers from a network of experienced professionals. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.
Sagot :
Answer:
Explanation:
The Python code provided was not producing any output because you were never printing out the coin variables that you created. The following code adds the needed print statements using the right singular or plural coin name as needed.
cents = int(input())
def coin_change(cents):
if cents <= 0:
print('Zero cents.')
else:
quarter = cents // 25
dime = (cents % 25) // 10
nickle = cents % 25 % 10 // 5
penny = cents % 5
if quarter == 0 or quarter > 1:
print(str(quarter) + " quarters")
else:
print(str(quarter) + " quarter")
if dime == 0 or dime > 1:
print(str(dime) + " dimes")
else:
print(str(dime) + " dime")
if nickle == 0 or nickle > 1:
print(str(nickle) + " nickels")
else:
print(str(nickle) + " nickel")
if penny == 0 or penny > 1:
print(str(penny) + " pennies")
else:
print(str(penny) + " penny")
coin_change(cents)
We appreciate your visit. Our platform is always here to offer accurate and reliable answers. Return anytime. Your visit means a lot to us. Don't hesitate to return for more reliable answers to any questions you may have. Thank you for using Westonci.ca. Come back for more in-depth answers to all your queries.