[Soc2015-general] Maximum to the Minimum

admin.dslcomputer at gmail.com admin.dslcomputer at gmail.com
Wed Jul 8 19:42:18 CEST 2015


Hi Everyone:


How do I rewrite the python script, below, to get a printout from the Maximum to the Minimum, and to convert a string into a number? 






largest = None
smallest = None
while True:
    num = raw_input("Enter a number")
    if num == "done" : break
    print num
    try: 
        inp=raw_input("enter a number:")
        num = float(inp)
    except:
        print "Invalid Input"
    continue
    if smallest is None:
            smallest = value
    elif value < smallest:
  smallest = value
    elif largest is None:
        largest = value
    elif value > largest:
        largest = value
    print "Maximum is", largest
    print "Minimum is", smallest



Regards,

Hal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/soc2015-general/attachments/20150708/89c2f4ef/attachment.html>


More information about the Soc2015-general mailing list