I need help with this simple code

Here is my code. I am trying to find both the small and large number in a series of entered numbers. It seems like the code only works for either small or large but not both…can anybody point me to what I am doing wrong? This is my first python program…Thank you!

sval = None
lval = None
while True :
    inp = input('Enter a number: ')
    if inp == 'done' :
        break
    #inp = float (inp)
    if sval is None and lval is None:
        sval = inp
        print ('sval value', sval)
        lval = inp
        print ('lval value', lval)
    if inp < sval and > lval:
        sval = inp
        print ('the value of sval',sval)
    if inp > lval:
        lval = inp
        print ('the value of lval', lval)
    #if lval is None:
        #lval = inp
        #if inp > lval:
        #    lval = inp
    #if inp == 'done' :
    #    break
    #if sval > inp:
        # sval = inp
    #elif lval < inp:
        #lval = inp
    try:
        inp = float(inp)
    except:
        print('Invalid input')
        continue
#    num = num + 1
    #tot = tot + fval

#print ('All Done')
print ('Invalid input')
print ('Maximum is', lval)
print ('Minimum is',sval)

Hi Ed,

if you will use numbers, compare numbers, if you will use strings compare strings…

string comparison and int/float comparisons work different… string are compared char by char and is not what you want to do if working with numbers, for example

“100” < “50” will be true if working with strings

but
100 < 50 will be false if working with integers…

variables that will be used as numbers should be initialized as numbers:

sval = lval = 0.0

before changing the value of sval o lval you should check de input value
try:
inp = float(inp)
except:
print(‘Invalid input’)
continue

after that you can update values
if inp > lval : lval = inp
if inp < sval: sval = inp

also you can use builtin max/min functions
lval = max(lval, inp)
sval = min(sval, min)