BbJLeB

Darts

May 16th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. # 04. Darts
  2. player = input()
  3. pole = None
  4.  
  5.  
  6. while pole != "Retire" or scores_end != 0:
  7.     pole = input()
  8.     score = int(input())
  9.     fail = 0
  10.     success = 0
  11.     scores_end = 301
  12.     if scores_end <= 301 and scores_end > 0 and fail < 3:
  13.         if pole == "Triple":
  14.             score = (score * 3)
  15.             scores_end = scores_end - score
  16.             success += 1
  17.             if score > scores_end:
  18.                 fail += 1
  19.         elif pole == "Double":
  20.             score = (score * 2)
  21.             scores_end = scores_end - score
  22.             success += 1
  23.             if score> scores_end:
  24.                 fail += 1
  25.         elif pole == "Single":
  26.             score = (score * 1)
  27.             scores_end = scores_end - score
  28.             success += 1
  29.             if score > scores_end:
  30.                 fail += 1
  31.  
  32.     else:
  33.         success += 1
  34.     print(f"{player} won the leg with {success} shots.")
  35.  
  36. if pole == "Retire":
  37.     print(f"{player} retired after {fail} unsuccessful shots.")
Advertisement
Add Comment
Please, Sign In to add comment