Share your repls and programming experiences

← Back to all posts
Rock, Paper, Sissors, Shoot!
applesX (19)

Can you beat the computer?

Commentshotnewtop
applesX (19)

Can I have help, I don’t know how to get it so you can keep playing, or so you can have the answer. I just started this and I think I’m failing lol

adl212 (54)

@applesX You probably want to use a while true loop to and to ask if you want to play again after the game is over. For example,

while True:
#rock paper scissors code
play_again = input('Do you want to play again? (y/n)')
if play_again == 'y':
  continue
if play_again == 'n':
  print('Bye bye!')
  break
else: #in case play_again is not y or n
  break

Overall, you did great on this! Add this into your code and you will have it so that you can keep on playing.

applesX (19)

Thank you SO MUCH,@adl212!!

applesX (19)

It says else is an invalid [email protected]

applesX (19)

Do you think you could edit it yourself and see what works maybe? I just started coding so I don’t know what’s wrong[email protected] Thanks