Advertisement
pacho_the_python

Untitled

Feb 2nd, 2022
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. time_needed = input().split()
  2.  
  3. final_line = int((len(time_needed) / 2))
  4.  
  5. time_num = list(map(int, time_needed))
  6. index_car_2 = len(time_num)
  7. car1 = time_num
  8. car_1_time = 0
  9. car_2_time = 0
  10. counter_0 = 0
  11. for i in range(final_line):
  12.  
  13.     car_1_time += car1[i]
  14.     if car1[i] == 0:
  15.         car_1_time = car_1_time - car_1_time * 0.2
  16.  
  17. for j in range(final_line):
  18.     car_2_time += time_num[index_car_2 -1]
  19.     index_car_2 -= 1
  20.     if car1[j] == 0:
  21.         car_2_time = car_2_time - car_2_time * 0.2
  22.  
  23. if car_1_time < car_2_time:
  24.     print(f"The winner is left with total time: {car_1_time:.1f}")
  25. elif car_1_time > car_2_time:
  26.     print(f"The winner is right with total time: {car_2_time:.1f}")
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement