Advertisement
Spocoman

Darts Tournament

Oct 6th, 2023
953
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. startPoints = int(input())
  2. moves = 0
  3.  
  4. while startPoints > 0:
  5.     command = input()
  6.     moves += 1
  7.  
  8.     if command == "bullseye":
  9.         break
  10.  
  11.     points = int(input())
  12.  
  13.     if command == "double ring":
  14.         points *= 2
  15.     elif command == "triple ring":
  16.         points *= 3
  17.  
  18.     startPoints -= points
  19.  
  20. if startPoints == 0:
  21.     print(f"Congratulations! You won the game in {moves} moves!")
  22. elif startPoints < 0:
  23.     print(f"Sorry, you lost. Score difference: {abs(startPoints)}.")
  24. else:
  25.     print(f"Congratulations! You won the game with a bullseye in {moves} moves!")
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement