Python help (computer guess number)
<p>Im learning how to programme in python and i found 2 tasks that should be pretty simple but second one is very hard for me and dont know how to make it work.</p>

<p>Basically i need to make program where computer guesses my number. So i enter number and than computer try's to guess it and everytime he picks number i need to enter lower or higher and this is the problem i dont how to. If anyone can advise me what can i do?</p>

<p>For example (number is 5):
computer asks 10?
i write lower
computer asks 4?
i write higher
after he guesses</p>

<p>Program:
I made a program already which automatically says higher or lower but i want to input lower or higher.</p>

<pre><code>from random import randit
number = int(input("Number? "))

attempts = 0
guess = 0

min = 0
max = 100

while guess != number:
  guess = randint(min,max)
  print(guess,"?")

  if guess &lt; number:
    print("Higher")
    min = guess
  elif guess &gt; number:
    print("Lower")
    max = guess

   attemps += 1

print("I needed", attempts, "attemps")
</code></pre>

<p>Thanks for anykind of help </p>

<pre><code>from random import randit 

attempts = 0
guess = 0 
min = 0
max = 100
while guess != number: 
  number = int(input("Number? ")) 
  guess = randint(min,max)
  print(guess,"?") 
  if guess &lt; number:
     print("Higher") 
     min = guess 
  elif guess &gt; number:
      print("Lower") 
      max = guess
  attemps += 1 
print("I needed", attempts, "attemps")
</code></pre>

<p>problem is your using a loop but inputting value once at start of app . just bring input inside the while statement hope this help</p>

python