I am having trouble returning an option of a list.
For example:
Fruits = {
'Apple': Apple, 'Banana': Banana, 'Orange': Orange}
def Choose_Fruit():
Choice = input('Choose a fruit: ')
if Choice not in Fruits:
Choose_Fruit()
return Choice
If I type 'Appppple', it will force me to choose again. If I then type 'Apple', it successfully returns the Choice but if I were to print it would reutrn 'Appppple' instead of 'Apple'. It prints the first input rather than the one that satisfies the if statement.
Aucun commentaire:
Enregistrer un commentaire