Question: I was wondering how to fix my program which asks for user input on any number.

To terminate the program, you input -99. Everything goes well as far as input goes, until I hit -99 to stop the program where it becomes the minimum. This is my code. The final answer for the minimum value cannot be -99.

```
s = -99
n = 1
minimum = None
maximum = None
print ("Enter a series of numbers")
print ("Enter -99 to quit.")
while n != s:
    n = float(input("Number: "))
    if minimum is None or n < minimum:
        minimum = n
    if maximum is None or n > maximum:
        maximum = n
    print ("The maximum is: ", maximum)
    print ("The minimum is: ", minimum)

```

Answer: 
```
1. n = 1
2. 1 == -99 ?
3. n = new input
4. set new minimum from n
5. n == -99?

```

First (4.) you set the new minimum from `n` (also if `n==-99`), any only then (5.) you test whether it is the value to stop.

I would suggest to change the loop into an infinite loop (`while True`) and then test whether it is -99 (break the loop in that case) and only afterwards set the new minimum/maximum values.

```
s = -99
n = 1
minimum = None
maximum = None
print ("Enter a series of numbers")
print ("Enter -99 to quit.")
while True:
    n = float(input("Number: "))
    if n == s:
        break
    if minimum is None or n < minimum:
        minimum = n
    if maximum is None or n > maximum:
        maximum = n
    print ("The maximum is: ", maximum)
    print ("The minimum is: ", minimum)

```
You need to check if the number is -99 at the end of the loop. You will want to get n before the loop as well. Also, you need to use a try block on float in case a non-float is input (float raises an exception here, not return None):

```
import sys

s = -99
n = 1
minimum = None
maximum = None
print ("Enter a series of numbers")
print ("Enter -99 to quit.")
try:
    n = float(input("Number: "))
except ValueError:
    sys.exit("You did not enter a float!")

while n != s:
    minimum = n if minimum is None else min(n, minimum)
    maximum = n if maximum is None else max(n, maximum)
    print ("The maximum is: ", maximum)
    print ("The minimum is: ", minimum)
    try:
        n = float(input("Number: "))
    except ValueError:
        sys.exit("You did not enter a float!")

```