Question
Python : Need help with output: My Code: while True: print(How much change should the customer get? ) change = int(input()) if change <0: print(change
Python : Need help with output:
My Code:
while True: print("How much change should the customer get? ") change = int(input()) if change<0: print("change must be a positive integer") continue else: print("return the following change:") if(change%25!=change and change>=25): print(int(change/25),"quarters") change = change%25
if(change%10!=change and change>=10): print(int(change/10),"dimes") change = change %10
if(change %5!=5 and change>=5): print(int(change/5),"nickels") change=change%5
if(change!=0 and change>0): print(int(change),"pennies")
print("Would you like to make more change? (y/Y/n/N)") choice=input() if(choice=='Y' or choice=='y'): print("Let\'s make some more change!")
else: print("Ok, I'll move along to something else...") break Output should look exactly like this:
How much change should the customer get?
-56
Change must be a positive integer
How much change should the customer get?
87
Return the following change:
3 quarters
1 dimes
2 pennies
Would you like to make more change(y/Y/n/N)
y
Let's make some more change!
How much change should the customer get?
56
Return the following change:
2 quarters
1 nickels
1 pennies
Would you like to make more change(y/Y/n/N)
Y
Let's make some more change!
How much change should the customer get?
35
Return the following change:
1 quarters
1 dimes
Would you like to make more change(y/Y/n/N)
blah
I did not recognize that response
Would you like to make more change(y/Y/n/N)
n
Ok, I'll move along to something else...
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started