[Tutor] help with inch to cms conversion .

Pravya Reddy pravyareddy at gmail.com
Mon Feb 11 17:06:39 CET 2013

Can you please help me with the code.

#!/usr/bin/env python


def Inchtocm(inches):
    """Returns 2.54 * inches"""
    return (2.54 * float(inches_number1))

inches = None
while True:
        inches_number1 = input(input("How many inches you want to convert:
        inches = float(inches_number1)
        print ("You got", Inchtocm(inches), "cm.")
        print ("You converted", inches, "inches to cm.")
    except ValueError:
        print ("This is not a number!")

The code is incomplete and i am not getting a proper output:

How many inches you want to convert: 455
This is not a number!
How many inches you want to convert:

Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130211/6bb49b7b/attachment.html>

More information about the Tutor mailing list