From 22e34cbd81fa8366046313bc7eda2056c8fb26f9 Mon Sep 17 00:00:00 2001 From: Aakanksha <58047210+Aakanksha2681@users.noreply.github.com> Date: Tue, 20 Oct 2020 19:15:30 +0530 Subject: [PATCH] Add files via upload create stop watch in python --- create stop watch.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 create stop watch.txt diff --git a/create stop watch.txt b/create stop watch.txt new file mode 100644 index 0000000..79be950 --- /dev/null +++ b/create stop watch.txt @@ -0,0 +1,13 @@ +import time +def convert_time(sec): + min = sec // 60 + sec = sec % 60 + hrs = min // 60 + min = min % 60 + print("Lapsed Time = {0}:{1}:{2}".format(int(hrs),int(min),sec)) +input("Press Enter to start") +start_time = time.time() +input("Press Enter to stop") +end_time = time.time() +lapsed_time = end_time - start_time +convert_time(lapsed_time)