0
Where to put: number of all guesses in guess game, PY ?
My code is: print("Guess the number. Try:") number = random.randint(1, 10) while True: a = int(input("number")) if a == number: print(" You are right!, the number is ", number) break else: print("Try again") I want to put number of guesses after print(" You are right!, the number is ", number)
2 Réponses
+ 2
Declare variable at the beginning that will hold tries amount and add its incrementation in else block 😉
edit. that incrementation should be right before "if" instead of in else block 😅
0
Great thx :)