49.9k views
17 votes
How would i change this:

" try:
userChoice = input("Would you like to Add or Multipy?(A/M): ")
except:
print("Please enter 'A' or 'M'") "

so it only allows me to put "A" or "M" so that it runs the except part

User LazyEval
by
7.4k points

1 Answer

3 votes

You wouldnt use a try and except statement. Use a loop.

How would i change this: " try: userChoice = input("Would you like to Add-example-1
User Angely
by
8.2k points

Related questions

asked Dec 2, 2024 73.1k views
Vcmkrtchyan asked Dec 2, 2024
by Vcmkrtchyan
8.7k points
1 answer
4 votes
73.1k views
asked Jul 15, 2024 44.5k views
Giggsey asked Jul 15, 2024
by Giggsey
8.0k points
1 answer
2 votes
44.5k views