``````print "Let's Play Rock, Paper, Scissors!!"
print "Rock beats scissors, paper beats rock, and scissors beats rock and paper! Have fun!"
import random
random.seed()
counter=0
user = 0
computer = 0
draw = 0

while counter <> 99:
counter = input("Please enter 1 for rock, 2 for paper, 3 for scissors, or 99 to end the game: ")
if counter == 1:
print "You picked", counter, "and the computer picked", random.choice(['1', '2', '3'])

elif counter == 2:
print "You picked", counter, "and the computer picked", random.choice(['1', '2', '3'])

elif counter == 3:
print "You picked", counter, "and the computer picked", random.choice(['1', '2', '3'])

if counter == '1' and random == '3':
print "You win!"
user+=1

elif counter == '2' and random == '1':
print "You win!"
user+=1

elif counter == '3' and random == '2':
print "You win!"
user+=1

elif counter == random:
print "It's a draw!"
draw+=1

elif counter == '99':
print "You have entered 99 to end the game!"

else:
print "You lose!"
computer+=1

import random
random.seed()
random.choice(['1', '2', '3'])
print "\n\nResults:"
print "You won", user,"games"
print "The computer won", computer, "games"
print "There were", draw, " draw games"``````

Edited by vegaseat: added code tags

2
Contributors
1
2
Views
8 Years
Discussion Span
Last Post by SgtMe

It's printing you lose because you are trying to use the module 'random' as a variable. Therefore, no statements in your loop for win checking are excepted, apart from, of course, the else statement, which prints 'You lose'.

You need to make a variable for the computers' choice. So this line, for example:

print "You picked", counter, "and the computer picked", random.choice()

Becomes:

``````#compCount is variable for the computer's turn
compCount == random.choice(['1', '2', '3'])
print "You picked", counter, "and the computer picked" compCount``````

PS:
Please use code tags, like I have, next time!

Edited by SgtMe: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.