Created
March 14, 2022 23:17
-
-
Save CEZERT/01a22574ed1f4ee70aa62043f2bdf42d 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
import functools | |
import time | |
def slow_down(func): | |
"""Sleep 1 second before calling the function""" | |
@functools.wraps(func) | |
def wrapper_slow_down(*args, **kwargs): | |
time.sleep(1) | |
return func(*args, **kwargs) | |
return wrapper_slow_down | |
@slow_down | |
def countdown(from_number): | |
if from_number < 1: | |
print("Liftoff!") | |
else: | |
print(from_number) | |
countdown(from_number - 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment