Advertisement
simeonshopov

Car race

Jan 15th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. numbers= [x for x in input().split(' ')]
  2.  
  3. half=  len(numbers) // 2
  4. time_1 = 0
  5. time_2 = 0
  6.  
  7. first_racer = numbers[:half]
  8. second_racer = numbers[half+1:][::-1]
  9.  
  10. for j in first_racer:
  11.   time_1 += int(j)
  12.   if int(j) == 0:
  13.     time_1 *= 0.8
  14.  
  15. for i in second_racer:
  16.   time_2 += int(i)
  17.   if int(i) == 0:
  18.     time_2 *= 0.8
  19.  
  20. if time_1 > time_2:
  21.   print(f'The winner is right with total time: {time_2:.1f}')
  22. else:
  23.   print(f'The winner is left with total time: {time_1:.1f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement