[Tutor] Can I get some feedback on my currency converter program

vikas mohan itechsys at gmail.com
Fri Dec 9 12:32:54 CET 2005


Hi all, this is my first program in python.

It's a currency converter mini-program, but I am not getting the desired
output. What wrong am I doing here?

*Program code:*

#converts currencies to Indian rupees

def print_options():
    print "Options:"
    print " 'p' print options"
    print " 'c' convert from US Dollars to Indian Rupees"
    print " 'f' convert from Swedish Kronors to Indian Rupees"
    print " 'g' convert from British Pound Sterling to Indian Rupees"
    print " 'q' quit the program"

def rupees_from_dollars(c_doll):
    return 43*1 --*The function is supposed to multiply the value of dollars
x 43(value of an Indian rupee)
*def rupees_from_kronor(f_kron):
    return 8*f_kron --*The function is supposed to multiply the value
of kronor x 8(value of an Indian rupee)*
def rupees_from_pounds(g_pound):
    return 68*g_pound --*The function is supposed to multiply the value
of pounds x 68(value of an Indian rupee)*

choice = "p"
while choice != "q":
    if choice == "c":
        Rupees = input("US Dollars:")
        print "Rupees:",--*The problem is here: I only get Rupees but not
the value multiplied as stated in the function.*
    elif choice == "f":
        Rupees = input("Swedish Kronor:")
        print "Rupees:" --*The problem is here: I only get Rupees but not
the value multiplied as stated in the function.*
    elif choice == "g":
        Rupees = input("UK Sterling:")
        print "Rupees:"--*The problem is here: I only get Rupees but not the
value multiplied as stated in the function.*
    elif choice != "q":
        print_options()
    choice = raw_input("option:")

-----------------------------------------

Much appreciate your help!

VikasM
**
**
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20051209/ab7168c3/attachment.htm


More information about the Tutor mailing list