Skip to content

Commit e87d09f

Browse files
authored
Create lap_time_counter.py
1 parent e5d89d0 commit e87d09f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lap_time_counter.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Starting Out with Python (4th Edition).
2+
# Tony Gaddis.
3+
# Page 225.
4+
# Programming Exercise.
5+
# Q 3. Lap Times.
6+
7+
round_count = int(input("Enter the number of rounds: ")) # number of times run around racetrack.
8+
time = 0 # timer at initial state.
9+
time_array = []
10+
11+
for timer in range(round_count):
12+
lap_time = float(input("Enter Lap Time: t = "))
13+
time_array.append(lap_time)
14+
time += lap_time
15+
16+
average_time = time/round_count
17+
fastest_time = max(time_array)
18+
slowest_time = min(time_array)
19+
print("Fastest Lap Time: ", fastest_time)
20+
print("Slowest Lap Time: ", slowest_time)
21+
print("Average Lap Time: ", average_time)

0 commit comments

Comments
 (0)