Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 04. Darts
- name = input()
- command = input()
- type = ''
- score = 301
- shots_counter_success = 0
- shots_counter_unsuccess = 0
- while command != "Retire":
- type = command
- reached_score = int(input())
- if command == "Single":
- if reached_score <= score:
- score -= reached_score
- shots_counter_success +=1
- else:
- score = score
- shots_counter_unsuccess +=1
- elif command == "Double":
- total_score = 2*reached_score
- if total_score <= score:
- score -= total_score
- shots_counter_success += 1
- else:
- score = score
- shots_counter_unsuccess += 1
- elif command == "Triple":
- total_score = reached_score * 3
- if total_score <= score:
- score -= total_score
- shots_counter_success += 1
- else:
- score = score
- shots_counter_unsuccess += 1
- if score == 0:
- print(f"{name} won the leg with {shots_counter_success} shots.")
- break
- command = input()
- if command == "Retire":
- print(f"{name} retired after {shots_counter_unsuccess} unsuccessful shots.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement