I'm a beginner in Python and I'm stuck on my code... I must write a code which:
-
Asks from the user an input considered as value money This one will be considered to be in EUR
-
Then calculates the value in YEN (1 EUR = 8.09647 YEN)
-
And displays and returns the result Here use both "print" and "return" functions
-
include tests / error messages / ... in order to guide the user when using the program
Here is the code I've already done and I don't understand why I can't get what i want
def currency_converter():
conversion = float(input('Enter a value in EUR to be converted to YEN:'))
YEN = 8.09647
EUR = EUR * YEN
error_message = 'Error: your input should be a positive number'
if (conversion.isdigit() == False):
return(error_message)
elif (conversion.isdecimal() == False):
return (error_message)
else:
print("Your input is equal to {output} stones".format(output=conversion)) #this line is from the teacher and should stay the same
return conversion
Any help will be welcome :)
Aucun commentaire:
Enregistrer un commentaire