-1

I am creating a rock, paper, scissor game i just try the random lib but this what happens

C:\Users\Timothy\Desktop>python app1.py
2
Please choose 1=Rock, 2=Paper, 3=Siccors2

and this is the code that I create

import random
ai = (random.randint(1,3))
print(ai)
play = input("Please choose 1=Rock, 2=Paper, 3=Siccors")
if ai == play:
    print("Hello")
Jostimian
  • 99
  • 1
  • 3
  • 7

1 Answers1

1

In Python 3, the input() method returns a string. So, play will be a string "1" and ai will be an integer 1. "1" != 1, hence your code will not execute the statements inside the if condition.

Chnage:

play = input("Please choose 1=Rock, 2=Paper, 3=Siccors")

To:

play = int(input("Please choose 1=Rock, 2=Paper, 3=Siccors"))
Dipen Dadhaniya
  • 4,550
  • 2
  • 16
  • 24