I typed my code and it works fine but when I want to put parameters that limit and send an error message to the user when he or she uses a number outside 0,1,2 it crashes. I have tried multiple ways but it still doesn’t work. This was my last attempt. This are lines 46-47:
if choiceInt >= 3 or choiceInt < 0:
print(“You typed an invalid number, you lose!”)
Also get this error message:
Traceback (most recent call last):
File “main.py”, line 43, in
choiceRPS = rps[choiceInt]
IndexError: list index out of range
Just want my code to be an able to send a “You typed an invalid number, you lose!” message if they don’t type the right number
Carlos Maravillo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.