I want this to loop 3 times buts it working, please look at code and help me out

+2 Ash Marz · July 5, 2015
from random import *

print("ROCK(0) \t PAPER(1) \t SCISSORS(2)")
choice = eval(input("Enter your choice: "))
if (choice == 0):
    print("You chose ROCK")
elif (choice == 1):
    print("You chose PAPER")
elif (choice == 2):
    print("You chose SCISSORS")

choice1 = randint(0,2)
if (choice1 == 0):
    print("The computer chose ROCK")
elif (choice1 == 1):
    print("The computer chose PAPER")
elif (choice1 == 2):
    print("The computer chose SCISSORS")
count = 0

while count
I want this program to loop 3 times and end which means that I just want to play 3 rounds of this game and then to stop, so how should I do it

Post a Reply

Replies

Oldest  Newest  Rating
0 Ash Marz · July 5, 2015
sorry its incomplete, i dont why i cant delete this post but  i AM going to make a new one
0 kevin brasher · July 5, 2015
Hey, Im not familar with the syntax of python but you will need to set a condition for the while loop. Something like while count != 3 and have your code in a do block so it would look like this  do{ your code here} while(your condition).
  • 1

Python

107,005 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator