# i dont know why my code isnt working pls help this is an assignment and i cant find the solution in the passages

edited Dec 6, 2022
from random import randint

random = randint(1, 3)
loop = True

while loop is True:

print("Start of the game...")

if random == 1:
player_choice = int(input("Type 1 for Rock, 2 for paper, 3 for scissors... : "))

if player_choice == 1:

print("You choose Rock!")

print("This round is a tie")

elif player_choice == 2:

print("You choose Paper!")

print("You won this round")

elif player_choice == 3:

print("You choose scissors!")

print("You lost this round")

elif random == 2:

#2 is paper

player_choice = input("Type 1 for Rock, 2 for paper, 3 for scissors... : ")

if player_choice == 1:

print("You choose Rock!")

print("You lost this round")

elif player_choice == 2:

print("You choose Paper!")

print("This round is a tie")

elif player_choice == 3:

print("You choose scissors!")

print("You won this round")

elif random == 3:

#3 is scissors

player_choice = input("Type 1 for Rock, 2 for paper, 3 for Scissors... : ")

if player_choice == 1:

print("You choose Rock!")

print("You won this round")

elif player_choice == 2:

print("You choose Paper!")

print("You lost this round")

elif player_choice == 3:

print("You choose Scissors!")

print("This round is a tie")

must be python 3

answered Dec 6, 2022 by (140 points)

Fix your indentions, that's all it is.

```from random import randint

random = randint(1, 3)
loop = True

while loop is True:

print("Start of the game...")

if random == 1:
player_choice: int = int(input("Type 1 for Rock, 2 for paper, 3 for scissors... : "))
if player_choice == 1:

print("You choose Rock!")

print("This round is a tie")

elif player_choice == 2:

print("You choose Paper!")

print("You won this round")

elif player_choice == 3:

print("You choose scissors!")

print("You lost this round")

elif random == 2:

#2 is paper

player_choice = input("Type 1 for Rock, 2 for paper, 3 for scissors... : ")

if player_choice == 1:

print("You choose Rock!")

print("You lost this round")

elif player_choice == 2:

print("You choose Paper!")

print("This round is a tie")

elif player_choice == 3:

print("You choose scissors!")

print("You won this round")

elif random == 3:

#3 is scissors

player_choice = input("Type 1 for Rock, 2 for paper, 3 for Scissors... : ")

if player_choice == 1:

print("You choose Rock!")

print("You won this round")

elif player_choice == 2:

print("You choose Paper!")

print("You lost this round")

elif player_choice == 3:

print("You choose Scissors!")

print("This round is a tie")```
answered Dec 7, 2022 by (180 points)
put quotation marks '' between the numbers when you are processing an input.
answered Dec 7, 2022 by (88,130 points)

What is not working? Can you be more specific? Do you have compilation errors? Runtime errors? Or the code runs, but it doesn't do what you want it to do? What is that you want but works differently in the implementation?

If you get the indentations right your code runs OK (but it's an infinite loop and you don't have any nice way to exit).

```from random import randint

random = randint(1, 3)
loop = True

while loop is True:
print("Start of the game...")
if random == 1:
player_choice = int(input("Type 1 for Rock, 2 for paper, 3 for scissors... : "))
if player_choice == 1:
print("You choose Rock!")
print("This round is a tie")
elif player_choice == 2:
print("You choose Paper!")
print("You won this round")
elif player_choice == 3:
print("You choose scissors!")
print("You lost this round")
elif random == 2:
#2 is paper
player_choice = input("Type 1 for Rock, 2 for paper, 3 for scissors... : ")
if player_choice == 1:
print("You choose Rock!")
print("You lost this round")
elif player_choice == 2:
print("You choose Paper!")
print("This round is a tie")
elif player_choice == 3:
print("You choose scissors!")
print("You won this round")
elif random == 3:
#3 is scissors
player_choice = input("Type 1 for Rock, 2 for paper, 3 for Scissors... : ")
if player_choice == 1:
print("You choose Rock!")
print("You won this round")
elif player_choice == 2:
print("You choose Paper!")
print("You lost this round")
elif player_choice == 3:
print("You choose Scissors!")
print("This round is a tie")```