Arksiana

6. High Jump

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