Question: Python. if you can give an example that would be great. Basically, I need help with making it so the user has to type y
Python. if you can give an example that would be great. Basically, I need help with making it so the user has to type y or n nothing else to continue or quit a program.
You have a long list of code and it performs a calculation. You ask the user at the end of the program another_calculation=input('Do you want to perform another calculation?(y/n):')
if (another_calculation_!='y')
do_calculation= False
The code runs
Do you want to perform another calculation ?(y/n):
The problem is you can type anything that is not a y to kill the program
How do you make it so that the user has to type y or n and if the user does not type n to quit the program it will keep repeating until the user types n or y. like I don't want the user typing in o instead of n to quit program?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
