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"...



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!




Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here