Jul-23-2017, 05:59 PM
Just to finish what i started,without random.
Then you can look at it an try to implement your max /min stuff.
Then you can look at it an try to implement your max /min stuff.
secret_number = 34 tries, guess = 0, 0 while guess != secret_number: guess = int(input("Take a guess: ")) if guess > secret_number: print("Lower...") elif guess < secret_number: print("Higher...") tries += 1 print('You guessed it! The number was {} in {} tries'.format(guess, tries))Test:
Output:C:\1_py\div
λ python guess.py
Take a guess: 34
You guessed it! The number was 34 in 1 tries
C:\1_py\div
λ python guess.py
Take a guess: 50
Lower...
Take a guess: 40
Lower...
Take a guess: 20
Higher...
Take a guess: 30
Higher...
Take a guess: 34
You guessed it! The number was 34 in 5 tries