max is None
min is None
while True:
number=input('Tell me a number: ')
try:
fnumber=float(number)
except:
if number=="done":
break
else:
print('not a number')
continue
if max is None:
max=fnumber
elif min is None:
min=fnumber
elif fnumber > max:
max=fnumber
elif fnumber < min:
min=number
print(max,min)
I'm trying to write a program that takes any amount of numbers the user provides and answers with the highest and the lowest. The problem is that I can't say the 'min' value equals 0 before any inputs, because then if the user put in the numbers 1 and 2 for example, 0 would still remain the minimum. So my initial value for min and max equals None, and in the code, it checks if min and max still equals none, and if it does, it changes the value of them to the number provided by the user. But Python ignores those two if statements, and skips ahead to the "elif fnumber > max" statement and gives me this error: TypeError: '>' not supported between instances of 'float' and 'builtin-function-or-method'