Created
March 17, 2022 03:27
-
-
Save KianYang-Lee/b2525b191098f55a57123d1d35d044d6 to your computer and use it in GitHub Desktop.
Simple program to mimic how to cook breakfast in a linear fashion
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
from time import sleep, time | |
def prep_breakfast(): | |
start_time = time() | |
def boil_water(): | |
print(">>> Start to boil water...") | |
sleep(8) # Sleep for 10 secs to mimic water boiling situation | |
print(">>> Water is boiled!") | |
def fry_egg(): | |
print(">>> Getting eggs from fridge...") | |
print(">>> Washing eggs...") | |
print(">>> Start to fry egg...") | |
sleep(10) # Sleep for 10 secs to mimic egg frying situation | |
print(">>> Egg is done!") | |
def make_bread(): | |
print(">>> Grabbing bread...") | |
print(">>> Apply jam on bread...") | |
boil_water() | |
print(">>> Pouring 3-in-1 coffee powder into cup...") | |
print(">>> Pouring boiled water into cup...") | |
fry_egg() | |
make_bread() | |
print(">>> Prep and serve...") | |
print(">>> Breakfast is ready! =)") | |
end_time = time() | |
print(f">>> It took me {end_time - start_time} seconds to make today's breakfast.") | |
if __name__ == "__main__": | |
prep_breakfast() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment