Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- car_racing_times = input().split()
- left_car_time = 0.0
- right_car_time = 0.0
- race_steps = len(car_racing_times) // 2
- # calculate left car time to reach the finish
- for current_time in range(race_steps):
- if int(car_racing_times[current_time]) == 0:
- left_car_time *= 0.80
- else:
- left_car_time += int(car_racing_times[current_time])
- # calculate right car time to reach the finish
- for current_time in range(2 * race_steps, race_steps, -1):
- if int(car_racing_times[current_time]) == 0:
- right_car_time *= 0.80
- else:
- right_car_time += int(car_racing_times[current_time])
- if left_car_time < right_car_time:
- print(f"The winner is left with total time: {left_car_time:.1f}")
- else:
- print(f"The winner is right with total time: {right_car_time:.1f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement