[Tutor] python help.. dictionary.
Yaj Lis
chronolee24 at hotmail.com
Mon Apr 5 19:06:00 EDT 2004
hello .. i'm new too python.. and programming..and learning slowly...
i'm creating a bank teller program. It has a list and dictionary.
It askes for the user's input (raw_input) asking for an amount. If the user
enters letters instead of an amount it would count it as 'counterfiet'.
Would i have to write a for loop function? how would i compare to see if it
is a string or an interger?..and i can't figure out how to work it with the
dictionary.. like if i put in $30.25.. it would return "you have 1 $20 bill,
1 ten, and 1 quarter" .. i'm so frustrated.
here's what i have so far..
wallet=raw_input("money in wallet ")
for i in conterfeit(x):
bank={}
bank['h']=100
bank['F']=50
bank['T']=20
bank['t']=10
bank['f']=5
bank['o']=1
bank['q']=.25
bank['d']=.10
bank['p']=.01
x=wallet
counterfeit(x)
I want the program to output something like this...It should report the
total value of the legal money as a floating point value (e.g. 123.45) and
the total number of counterfeit pieces received.
Money in wallet: asdfasdf
Contained "1" counterfiet piece(s).
Total amount in bank $20.00
asking for any help? thanks a lot..
_________________________________________________________________
Watch LIVE baseball games on your computer with MLB.TV, included with MSN
Premium!
http://join.msn.com/?page=features/mlb&pgmarket=en-us/go/onm00200439ave/direct/01/
More information about the Tutor
mailing list