/
rnekrasov
/
Python
Обзор
Документация
Войти
/
rnekrasov
/
Python
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
SimpleStopWatch.py
19 строк
672 B
slowy07
refactor: clean code
30 янв 2022, 04:33
30 янв 2022, 04:33
f0af0c4
Код
Авторство
О чём код?
# Author: OMKAR PATHAK # This script helps to build a simple stopwatch application using Python's time module. import time print("Press ENTER to begin, Press Ctrl + C to stop") while True: try: input() # For ENTER. Use raw_input() if you are running python 2.x instead of input() starttime = time.time() print("Started") while True: print("Time Elapsed: ", round(time.time() - starttime, 0), "secs", end="\r") time.sleep(1) # 1 second delay except KeyboardInterrupt: print("Stopped") endtime = time.time() print("Total Time:", round(endtime - starttime, 2), "secs") break