What do you think is wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

11th Jun 2020, 1:14 PM
Dii Ayo
Dii Ayo - avatar
4 Answers
+ 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
11th Jun 2020, 1:16 PM
Abhay
Abhay - avatar
+ 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")
11th Jun 2020, 1:28 PM
Runtime Terror
Runtime Terror - avatar
+ 2
You should ask for input again in while loop
11th Jun 2020, 1:22 PM
Vijay Raj Jain
0
Thank you everyone for your help. I'm grateful for a problem-solving community 😁
12th Jun 2020, 8:55 PM
Dii Ayo
Dii Ayo - avatar