PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#simple clock that prints the time to the second in the output
import datetime
import time
clock = True
def refreshTime():
while clock:
now = datetime.datetime.now()
time.sleep(1)
print(str(now)[:19])
#show time to 19th character(seconds)
refreshTime()
#this works on my computer but SoloLearn says "time limit exceeded"
#if you know an easier way to code this, please comment. THANK YOU!
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run