Advertisement
BbJLeB

06. High Jump

Jun 9th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. # 06. High Jump
  2. aim = int(input())
  3. start = aim - 30
  4. bad_count = 0
  5. total_jumps = 0
  6.  
  7. while not(start > aim):
  8.     if bad_count == 3:
  9.         break
  10.     jump = int(input())
  11.     total_jumps += 1
  12.     if jump > start:
  13.         start += 5
  14.         bad_count = 0
  15.     else:
  16.         bad_count += 1
  17.  
  18. if bad_count == 3:
  19.     print(f"Tihomir failed at {start}cm after {total_jumps} jumps.")
  20. else:
  21.     print(f"Tihomir succeeded, he jumped over {start - 5}cm after {total_jumps} jumps.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement