[Tutor] please help - stuck for hours
ADRIAN KELLY
kellyadrian at hotmail.com
Thu Nov 17 22:19:45 CET 2011
i have tried everything, i am trying to build in a loop to my 2 functions which worked fine up until my latest sorti.
please have a look if you can..............
def exchange(cash_in): euro=1 dollar=1.35 base=50 if cash_in>base: totalreturn=cash_in*dollar else: totalreturn=0 return totalreturn
def main(): amount="" while amount<50: print 'Sorry, cannot convert an amount under €50 ' amount = input('how much do you want to change:') else: total=exchange(amount) print 'Your exchange comes to: ',total main()
Traceback (most recent call last): File "F:\VTOS ATHLONE\PYTHON_VTOS\foreign exchange\f_ex3.py", line 27, in <module> main() File "F:\VTOS ATHLONE\PYTHON_VTOS\foreign exchange\f_ex3.py", line 19, in main total=exchange(amount) File "F:\VTOS ATHLONE\PYTHON_VTOS\foreign exchange\f_ex3.py", line 7, in exchange totalreturn=cash_in*dollarTypeError: can't multiply sequence by non-int of type 'float'>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111117/4317fdcf/attachment.html>
More information about the Tutor
mailing list