Skip to content

Instantly share code, notes, and snippets.

@toniesteves
Last active June 15, 2020 04:52
Show Gist options
  • Save toniesteves/78f18cc88c1c8c4b0f7ad9ddc52ad368 to your computer and use it in GitHub Desktop.
Save toniesteves/78f18cc88c1c8c4b0f7ad9ddc52ad368 to your computer and use it in GitHub Desktop.
import time
lot_of_items = ['coffee'] * 100000
def find_coffee(items):
start = time.time()
for item in items:
if(item == 'coffe'):
print('Found Coffee')
finish = time.time()
print('The operation took {} ms'.format(finish - start));
find_coffee(lot_of_items);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment