jeudi 18 mars 2021

Python, how to use for loop to check if an item is in the list, and print the following [closed]

Hello:) Does anyone knows how to perform the following instruction? how to use for loop to check if an item is in the list, and sort using alphabetical order

def find(fruit, kind): """Print in alphabetical order all fruit corresponding to the given kind name

>>> find(["Banana", "Apple", "Pineapple", "Strawberry", "Waxapple"], "apple")
output= Apple Pineapple Waxapple

>>> find(["Banana", "Strawberry"], "apple")
output= No such fruit

Aucun commentaire:

Enregistrer un commentaire