Last active
August 8, 2020 10:51
-
-
Save bowmanjd/e34dbd88af7e7a718c129b6676f1ba5e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
"""Send greetings.""" | |
import time | |
import arrow | |
def greet(tz, repeat=1, interval=3): | |
"""Parse a timezone and greet a location a number of times.""" | |
for i in range(repeat): | |
if i > 0: # no delay needed on first round | |
time.sleep(interval) | |
now = arrow.now(tz) | |
friendly_time = now.format("h:mm a") | |
seconds = now.format("s") | |
location = tz.split("/")[-1].replace("_"," ") | |
print(f"Hello, {location}!") | |
print(f"The time is {friendly_time} and {seconds} seconds.\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment