Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e0eb3f7

Browse files
alternate program update (#21)
Press enter to start and stop the watch
1 parent 2029a5e commit e0eb3f7

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

‎Programs/P19_SimpleStopWatch.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,32 @@
1414
endtime = time.time()
1515
print('Total Time:', round(endtime - starttime, 2),'secs')
1616
break
17+
# Press enter to start and stop the watch
18+
"""
19+
import time
20+
21+
print('Press Enter to begin, Press Enter again to stop')
22+
if input()=='':
23+
starttime = time.time()
24+
print('Started')
25+
while True:
26+
val=input() #For ENTER
27+
if val=='':
28+
print('Stopped')
29+
endtime = time.time()
30+
print('Total Time:', round(endtime - starttime, 2),'secs')
31+
break
32+
33+
"""
34+
35+
"""
36+
Output:
37+
Press Enter to begin, Press Enter again to stop
38+
39+
Started
40+
41+
Stopped
42+
Total Time: 1.05 secs
43+
44+
"""
45+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /