Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- name = input()
- zone = input()
- count_yes = 0
- count_no = 0
- total = 301
- while zone != "Retire":
- dots = int(input())
- if zone == "Double":
- dots *= 2
- elif zone == "Triple":
- dots *= 3
- if total < dots:
- count_no += 1
- else:
- total -= dots
- count_yes += 1
- if total == 0:
- break
- zone = input()
- if total == 0:
- print(f"{name} won the leg with {count_yes} shots.")
- else:
- print(f"{name} retired after {count_no} unsuccessful shots.")
- РЕШЕНИЕ С ТЕРНАРЕН ОПЕРАТОР:
- name = input()
- zone = input()
- count_yes = 0
- count_no = 0
- total = 301
- while zone != "Retire":
- dots = int(input()) * (2 if zone == "Double" else 3 if zone == "Triple" else 1)
- count_yes += 1 if total >= dots else 0
- count_no += 1 if total < dots else 0
- total -= dots if total >= dots else 0
- if total == 0:
- break
- zone = input()
- print(f"{name} won the leg with {count_yes} shots." if total == 0
- else f"{name} retired after {count_no} unsuccessful shots.")
- РЕШЕНИЕ С КОЛЕКЦИЯ И ТЕРНАРЕН ОПЕРАТОР:
- name = input()
- zone = input()
- count_yes = 0
- count_no = 0
- total = 301
- while zone != "Retire":
- dots = int(input()) * {"Single": 1, "Double": 2, "Triple": 3}[zone]
- count_yes += 1 if total >= dots else 0
- count_no += 1 if total < dots else 0
- total -= dots if total >= dots else 0
- if total == 0:
- break
- zone = input()
- print(f"{name} won the leg with {count_yes} shots." if total == 0
- else f"{name} retired after {count_no} unsuccessful shots.")
Add Comment
Please, Sign In to add comment