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

vikas mohan itechsys at gmail.com
Fri Dec 9 13:57:34 CET 2005

```Thanks! Looks in a better shape now! I have a diffrent question now: What if
like in Java, i would like to have live currency quotes fed to my function,
from some forex dealer website? So, that my program can provide uptodate
info. How can I hot/live link my function?

/VikasM

#converts currencies indo Indian rupees

print "Welcome to your currency converter\n"
print "Plese choose from the following opitons\n"
def print_options():
print "Options:"
print " 'p' print options"
print " '\$' convert from US Dollars to Indian Rupees"
print " 'kr' convert from Swedish Kronors to Indian Rupees"
print " '£' convert from British Pound Sterling to Indian Rupees"
print " 'eu' convert from Euros to Indian Rupees"
print " 'q' quit the program"

def rupees_from_dollars(d_doll):
return 43*(d_doll)
def rupees_from_kronor(kr_kron):
return 8*(kr_kron)
def rupees_from_pounds(p_pound):
return 68*(p_pound)
def rupees_from_euros(eu_euros):
return 54*(eu_euros)

choice = "p"
while choice != "q":
if choice == "\$":
Rupees = input("US Dollars:")
print "Rupees:",rupees_from_dollars(Rupees)
elif choice == "kr":
Rupees = input("Swedish Kronor:")
print "Rupees:",rupees_from_kronor(Rupees)
elif choice == "£":
Rupees = input("UK Sterling:")
print "Rupees:",rupees_from_pounds(Rupees)
elif choice == "eu":
Rupees = input("Euros:")
print "Rupees:",rupees_from_euros(Rupees)
elif choice != "q":
print_options()

choice = raw_input("Choose option:")

On 12/9/05, Ewald Ertl <ewald.ertl at hartter.com> wrote:

> Hi!
>
> vikas mohan wrote:
> > 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
>
> Here is the c_doll missing
>        return 43*c_doll
>
> > 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:")
> Rupees contains the inserted value
> >         print "Rupees:",--*The problem is here: I only get Rupees but
> Here just the Text"Rupees:" is printed
>
>          print "Rupees:", rupees_from_dollars(Rupees)
>
> or        print "Rupees: %d\n" % ( rupees_from_dollars( Rupees ) )
>
> You have to call the function to get the converted value.
>
> > 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
> >
> > **
> > **
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
>
> HTH Ewald
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20051209/ed734be7/attachment.htm
```