-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2.py
More file actions
23 lines (23 loc) · 660 Bytes
/
2.py
File metadata and controls
23 lines (23 loc) · 660 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def odometer(N):
long = len(N)
if long >= 2:
num = 0
sum_distance = 0
distance_all = 0
for index, number in enumerate(N):
if index%2 == 0:
speed = N[index]
else:
if num == 0:
time = N[index]
num=+1
distance = speed*time
else:
time_new = N[index] - time
time = N[index]
distance = speed*time_new
sum_distance += distance
distance_all += sum_distance
return distance_all
else:
exit()