Python Coding- Except ValueError
Using Except ValueError, change the program so that if the user inputs something other than "Y" or "N", the program will print to the counsole "Please input Y or N" and re-ask if the user would like the instructions.
Here is the coding:
def ins():print("There are 23 cases, containing amounts of money varying between $1 and $25k!")
print("Type 'Y' for yes or 'N' for no.")userInstruction=input("Do you want instructions on how to play?").upper()
if userInstruction=="Y":ins()elif userInstruction:print("OK! Let's begin!")winsound.Beep(345, 500)time.sleep(0.5)else:print("Please input 'Y' or 'N'.")
Thank you!
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here