This is my code for a school project (I am writing this in Python 2.7.13
):
def euconverter(mon, rate):
return (mon * rate)
cur = raw_input('Please give me the currency')
mon = raw_input('Please give me the value')
rate = raw_input('Please give me the rate')
while cur == 'EUR' or cur == 'Eur' or cur == 'GBP' or cur == 'Gbp':
if cur == 'Eur' or cur == 'Eur':
print (euconverter(mon, rate))
elif cur == 'GBP' or cur == 'Gbp':
print (euconverter(mon, rate))
else:
if cur != 'EUR' or cur != 'Eur' or cur != 'GBP' or cur != 'Gbp':
print 'Wrong input'
break
I get this error:
Traceback (most recent call last):
File "C:/Users/Maple/PycharmProjects/untitled/Mid term Project.py", line 15, in <module>
print (euconverter(mon, rate))
File "C:/Users/Maple/PycharmProjects/untitled/Mid term Project.py", line 2, in euconverter
return int(mon * rate)
TypeError: can't multiply sequence by non-int of type 'str'
Also, if I type a numeric value when it is asking me for the currency type, then the program exits without displaying any messages. This is a school project, so I am expecting to get wrong inputs from the users and need to provide them with the required error message while trying to make them go back and input the correct one.