-
Notifications
You must be signed in to change notification settings - Fork 1
/
Time.py
38 lines (38 loc) · 1.03 KB
/
Time.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import time
second = 0
minute = 0
hours =0
stopformat=input("Do you want to stop for second or minute: ")
if stopformat == "second":
insec=int(input("Enter the seconds"))
while (second <= insec):
print("Simple Stopwatch(in Python) ")
print('\n')
print(hours, minute, second)
print('-------------')
time.sleep(1)
second += 1
if (second == 60):
second = 0
minute += 1
if (minute == 60):
minute = 0
hours += 1
os.system('cls')
elif stopformat == "minute":
inmin=int(input("Enter the minutes: "))
while (minute <= inmin):
print("Simple Stopwatch(in Python) ")
print('\n')
print(hours, minute, second)
print('-------------')
time.sleep(1)
second += 1
if (second == 60):
second = 0
minute += 1
if (minute == 60):
minute = 0
hours += 1
os.system('cls')