Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- target_bar_height = int(input())
- bar_height = target_bar_height - 30
- failed_attempts = 0
- total_attempts = 0
- target_bar_success = False
- while True:
- jump_height = int(input())
- total_attempts += 1
- if jump_height > bar_height:
- if bar_height >= target_bar_height:
- target_bar_success = True
- break
- bar_height += 5
- failed_attempts = 0
- else:
- failed_attempts += 1
- if failed_attempts > 2: # == 3
- break
- if target_bar_success:
- print(f"Tihomir succeeded, he jumped over {bar_height}cm after {total_attempts} jumps.")
- else:
- print(f"Tihomir failed at {bar_height}cm after {total_attempts} jumps.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement