+ 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
4 Answers
+ 1
You can use a for loop.
https://code.sololearn.com/cBXtFMDgufqZ/?ref=app
+ 2
if guess != x:
guess = int(input("try again: \n"))
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ā
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ā.