0
What do you think is wrong?
I'm trying to create a simple game that generates two numbers for two players and declares the player with the highest number as the winner. https://code.sololearn.com/c9WY441IhrTb/?ref=app
5 ответов
+ 5
When I input yes Loop runs infinitely ,also last statement is print not Print ,also elif comes in same line as if ,elif can't start without if
+ 4
There are some error in you code
Correct code is given below
print("Wanna play?\n Yes or No")
play=input()
if play=="Yes":
import random
player1=random.randint(1,200)
player2 =random.randint(1, 200)
if player1 > player2 :
print("player1 wins")
elif player1==player2 :
print("It's a tie")
else:
print ("Player2 wins")
print("I hope you had fun")
+ 2
You should ask for input again in while loop
0
Thank you everyone for your help. I'm grateful for a problem-solving community 😁