Python: finding lowest integer

Posted by sarah on Stack Overflow See other posts from Stack Overflow or by sarah
Published on 2010-04-12T14:57:47Z Indexed on 2010/04/12 15:03 UTC
Read the original article Hit count: 338

Filed under:
|
|

I have the following code:

l = ['-1.2', '0.0', '1']

x = 100.0
for i in l:
    if i < x:
        x = i
print x

The code should find the lowest value in my list (-1.2) but instead when i print 'x' it finds the value is still 100.0 Where is my code going wrong?

© Stack Overflow or respective owner

Related posts about python

Related posts about integer