Mando985 / Rock-paper-scissors-game

A program for creating a simple rock-paper-scissors game
0 stars 0 forks source link

Preventing Syntax Error #1

Open DarkDevil-1 opened 2 years ago

DarkDevil-1 commented 2 years ago

You can prevent unnecessary syntax errors in the code by adding a variable options including the possible options the user can type and if the user input is not found in it you can rerun the code

options = [a,b,c] if x is not in options: print('Please enter a given option') game()

Mando985 commented 2 years ago

Its " if x not in options" not "if x is not in options". kundi swag

ayo its not working

nvm fixed it

options = ["a", "b", "c"] if x not in options: print('Please enter a given option') game() now my "dou you want to play again" thing is glitching. i type no, it asks me again u wanna play again?

DarkDevil-1 commented 2 years ago

options = ["a", "b", "c"]` if x in options:

    #ALL THE CODE HERE

    h = input("Do you want to play again? (Y/N)\n==>")
    j = h.lower()
    if j == "y":
       game()    

else:
    print("Invalid input, try again")
    game()