Created
October 25, 2021 01:54
-
-
Save ycui1/10a164f8c687c6be18bfc29acebdc125 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def any_liked_fruit(fruits, liked_fruit): | |
liked = False | |
for fruit in fruits: | |
print(f"Checking {fruit} likable") | |
if not liked and fruit == liked_fruit: | |
liked = True | |
print("Found liked") | |
return liked | |
any_liked_fruit(["apple", "pineapple", "orange"], "pineapple") | |
Checking apple likable | |
Checking pineapple likable | |
Checking orange likable | |
Found liked |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment