Im having problems with the while loop terminating the rock paper scissors game once it gets to the choice variable to say no. Also when i initially enter my input in the beginning, it will only give me 'tie' back in the shell. It wont give any other response. Its like the random choice isnt working. BTW im running in python shell 3.5.4.
-----
import random
ROCK=1
PAPER=2
SCISSORS=3
keeprunning = True
while keeprunning == True:
user = input("rock/paper/scissors: ")
roll = random.randint(1,3)
if user == 'rock' or user == 'Rock' and 'roll' == 'ROCK':
print('tie')
elif user == 'rock' or user == 'Rock' and 'roll' == 'PAPER':
print('you lose')
elif user == 'rock' or user == 'Rock' and 'roll' == 'SCISSORS':
print('you win')
elif user == 'paper' or user == 'Paper' and 'roll' == 'ROCK':
print('you win')
elif user == 'paper' or user == 'Paper' and 'roll' == 'PAPER':
print('tie')
elif user == 'paper' or user == 'Paper' and 'roll' == 'SCISSORS':
print('you lose')
elif user == 'scissors' or user == 'Scissors' and 'roll' == 'SCISSORS':
print('tie')
elif user == 'scissors' or user == 'Scissors' and 'roll' == 'ROCK':
print('you lose')
elif user == 'scissors' or user == 'Scissors' and 'roll' == 'PAPER':
print('you win')
choice = input('Do you want to play another game?: ')
if choice == 'yes' or 'Yes':
keeprunning == True
else:
keeprunning == False
print('Good game')
-----
import random
ROCK=1
PAPER=2
SCISSORS=3
keeprunning = True
while keeprunning == True:
user = input("rock/paper/scissors: ")
roll = random.randint(1,3)
if user == 'rock' or user == 'Rock' and 'roll' == 'ROCK':
print('tie')
elif user == 'rock' or user == 'Rock' and 'roll' == 'PAPER':
print('you lose')
elif user == 'rock' or user == 'Rock' and 'roll' == 'SCISSORS':
print('you win')
elif user == 'paper' or user == 'Paper' and 'roll' == 'ROCK':
print('you win')
elif user == 'paper' or user == 'Paper' and 'roll' == 'PAPER':
print('tie')
elif user == 'paper' or user == 'Paper' and 'roll' == 'SCISSORS':
print('you lose')
elif user == 'scissors' or user == 'Scissors' and 'roll' == 'SCISSORS':
print('tie')
elif user == 'scissors' or user == 'Scissors' and 'roll' == 'ROCK':
print('you lose')
elif user == 'scissors' or user == 'Scissors' and 'roll' == 'PAPER':
print('you win')
choice = input('Do you want to play another game?: ')
if choice == 'yes' or 'Yes':
keeprunning == True
else:
keeprunning == False
print('Good game')
import random ROCK=1 PAPER=2 SCISSORS=3 keeprunning = True while keeprunning == True: user = input("rock/paper/scissors: ") roll = random.randint(1,3) if user == 'rock' or user == 'Rock' and 'roll' == 'ROCK': print('tie') elif user == 'rock' or user == 'Rock' and 'roll' == 'PAPER': print('you lose') elif user == 'rock' or user == 'Rock' and 'roll' == 'SCISSORS': print('you win') elif user == 'paper' or user == 'Paper' and 'roll' == 'ROCK': print('you win') elif user == 'paper' or user == 'Paper' and 'roll' == 'PAPER': print('tie') elif user == 'paper' or user == 'Paper' and 'roll' == 'SCISSORS': print('you lose') elif user == 'scissors' or user == 'Scissors' and 'roll' == 'SCISSORS': print('tie') elif user == 'scissors' or user == 'Scissors' and 'roll' == 'ROCK': print('you lose') elif user == 'scissors' or user == 'Scissors' and 'roll' == 'PAPER': print('you win') choice = input('Do you want to play another game?: ') if choice == 'yes' or 'Yes': keeprunning == True else: keeprunning == False print('Good game')