+ 2

1-100loop

The user has 10 chances of guessing a number betwenn 1-100. He will be notified if his guess is higher or lower than the hidden number or above 100 or below 1. The random number is 60 in this case. How do i make a loop with 10 chances and the programme should also know how many loop or times the code has been repeated. My attempts so far: https://code.sololearn.com/c0ZKm692txfE/?ref=app https://code.sololearn.com/c6xT8qlO8M8f/?ref=app

30th Jan 2022, 9:37 PM
Lenoname
4 Answers
31st Jan 2022, 5:22 AM
Sanjyot21
Sanjyot21 - avatar
+ 2
if guess != x: guess = int(input("try again: \n"))
31st Jan 2022, 12:34 PM
Oma Falk
Oma Falk - avatar
0
Oma Falk how do i get rid of the last ”wrong, guess a higher or lower number” on the last try? I want it to instead say ”wrong”
31st Jan 2022, 9:20 AM
Lenoname
0
Oma Falk i mean when the user has guessed wrong 10 times it will be printed ”wrong, guess a higher or lower number”, it was the last chance the user had and he cant guess again, so ”try again” or ” guess a higher/lower number” shouldnt be printed, instead it should be only ”wrong”.
1st Feb 2022, 12:04 AM
Lenoname