Skip to content

Instantly share code, notes, and snippets.

@ycui1
Created October 25, 2021 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ycui1/10a164f8c687c6be18bfc29acebdc125 to your computer and use it in GitHub Desktop.
Save ycui1/10a164f8c687c6be18bfc29acebdc125 to your computer and use it in GitHub Desktop.
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