Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- height = int(input())
- jump = 0
- jump_counter = 0
- is_failed = False
- fail = 0
- thirty_cm_below_target = height - 30
- while thirty_cm_below_target <= height:
- jump = int(input())
- jump_counter += 1
- if jump <= thirty_cm_below_target:
- fail += 1
- if fail == 3:
- is_failed = True
- break
- else:
- thirty_cm_below_target += 5
- fail = 0
- if is_failed:
- break
- if not is_failed:
- print(f"Tihomir succeeded, he jumped over {height}cm after {jump_counter} jumps.")
- else:
- print(f'Tihomir failed at {thirty_cm_below_target}cm after {jump_counter} jumps.')
Advertisement
Add Comment
Please, Sign In to add comment