Advertisement
mirovlad

High Jump Judge 100%

May 29th, 2022
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. target_bar_height = int(input())
  2.  
  3. bar_height = target_bar_height - 30
  4. failed_attempts = 0
  5.  
  6. total_attempts = 0
  7.  
  8. target_bar_success = False
  9.  
  10. while True:
  11.     jump_height = int(input())
  12.     total_attempts += 1
  13.     if jump_height > bar_height:
  14.         if bar_height >= target_bar_height:
  15.             target_bar_success = True
  16.             break
  17.         bar_height += 5
  18.         failed_attempts = 0
  19.     else:
  20.         failed_attempts += 1
  21.  
  22.     if failed_attempts > 2:  # == 3
  23.         break
  24.  
  25. if target_bar_success:
  26.     print(f"Tihomir succeeded, he jumped over {bar_height}cm after {total_attempts} jumps.")
  27. else:
  28.     print(f"Tihomir failed at {bar_height}cm after {total_attempts} jumps.")
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement