Advertisement
anton_d

06.high_jump

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