Python Forum
How do you make my code continue going ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you make my code continue going ?
#1
Hello! i just coded a rock paper scissors game but i have one issue...
The whole code is completely okay but when i input Rock paper or Scissors in i get the out put and the game ends...
I want to make the game run for ever so i don't have to restart the game everytime i want to play.
How do you do that ? 

from random import randint

Game = ["Rock", "Paper", "Scissors"]

Robot = Game[randint(0,2)]

Gamer = False

while Gamer == False:
    Gamer = input ("Choose your action! Rock, Paper or Scissors? : " )
    if Gamer == Robot:
        print ("Tie! You both chose the same action!")
    elif Gamer == "Rock":
        if Robot == "Scissors":
            print ("You Win!")
        else:
            print ("You Lose!")
    elif Gamer == "Paper":
        if Robot == "Rock":
            print ("You Win!")
        else:
            print ("You Lose!")
    elif Gamer == "Scissors":
        if Robot == "Paper":
            print ("You Win!")
        else:
            print ("You Lose!")
    else:
        print ("Please check if you spelled your action correctly!")
Gamer = False
Robot = Game[randint(0,2)]
Thank you for taking your time reading my Post.
Also thank you taking your time to help me solve this issue!
Really appreciated :P   -TheSpalekUk
Reply
#2
set gamer to true and loop of gamer is true
...
Gamer = True
 
while Gamer:
....
You would also want to make use of str.lower() to make sure the user doesnt have to cap things

>>> 'Rock'.lower()
'rock'
Recommended Tutorials:
Reply
#3
ok thanks for help
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  hi need help to make this code work correctly atulkul1985 5 702 Nov-20-2023, 04:38 PM
Last Post: deanhystad
  newbie question - can't make code work tronic72 2 626 Oct-22-2023, 09:08 PM
Last Post: tronic72
  Cleaning my code to make it more efficient BSDevo 13 1,275 Sep-27-2023, 10:39 PM
Last Post: BSDevo
  how to make bot that sends instagram auto password reset code kraixx 2 1,283 Mar-04-2023, 09:59 PM
Last Post: jefsummers
  Make code non-blocking? Extra 0 1,099 Dec-03-2022, 10:07 PM
Last Post: Extra
  List Creation and Position of Continue Statement In Regular Expression Code new_coder_231013 3 1,603 Jun-15-2022, 12:00 PM
Last Post: new_coder_231013
  Make the code shorter quest 2 1,477 Mar-14-2022, 04:28 PM
Last Post: deanhystad
  How would you (as an python expert) make this code more efficient/simple coder_sw99 3 1,755 Feb-21-2022, 10:52 AM
Last Post: Gribouillis
  Pyspark - my code works but I want to make it better Kevin 1 1,746 Dec-01-2021, 05:04 AM
Last Post: Kevin
  List index out of range error when attempting to make a basic shift code djwilson0495 4 2,936 Aug-16-2020, 08:56 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020