Skip to content

Instantly share code, notes, and snippets.

@bowmanjd
Last active August 8, 2020 10:51
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 bowmanjd/e34dbd88af7e7a718c129b6676f1ba5e to your computer and use it in GitHub Desktop.
Save bowmanjd/e34dbd88af7e7a718c129b6676f1ba5e to your computer and use it in GitHub Desktop.
"""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