Arksiana

fixed / High Jump

Nov 12th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. target = int(input())
  2. start_high = target - 30
  3. faild_jumps = 0
  4. total_jumps = 0
  5. yes = True
  6.  
  7. while start_high <= target:
  8.     jumped_high = int(input())
  9.  
  10.     if jumped_high > start_high:
  11.         start_high += 5
  12.         total_jumps += 1
  13.         faild_jumps = 0
  14.     else:
  15.         faild_jumps += 1
  16.         total_jumps += 1
  17.  
  18.     if faild_jumps == 3:
  19.         yes = False
  20.         print(f'Tihomir failed at {start_high}cm after {total_jumps} jumps.')
  21.         break
  22.  
  23. if yes:
  24.     print(f'Tihomir succeeded, he jumped over {start_high - 5}cm after {total_jumps} jumps.')
Advertisement
Add Comment
Please, Sign In to add comment