[issue6955] Max() Not Working Properly

lovelygoo2 report at bugs.python.org
Mon Sep 21 05:03:06 CEST 2009


New submission from lovelygoo2 <smergibblegibberish at usa.com>:

>>> max(['34', '7'])
'7'
>>> #This happens because it is comparing strings.
>>> #I have found a way to fix it though.
>>> def Max(li):
...    greatest=li[0]
...    for item in li:
...        for item2 in li:
...            if int(item)<int(item2) or int(item)<greatest:
...                break
...            else:
...                greatest=int(item)
...    return(greatest)

----------
components: IDLE
messages: 92920
nosy: lovelygoo2
severity: normal
status: open
title: Max() Not Working Properly
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6955>
_______________________________________


More information about the Python-bugs-list mailing list