Advertisement
aneliabogeva

Darc

May 16th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. name = input()
  2. command = input()
  3. type = ''
  4. score = 301
  5. shots_counter_success = 0
  6. shots_counter_unsuccess = 0
  7.  
  8. while command != "Retire":
  9. type = command
  10. reached_score = int(input())
  11. if command == "Single":
  12. if reached_score <= score:
  13. score -= reached_score
  14. shots_counter_success +=1
  15. else:
  16. score = score
  17. shots_counter_unsuccess +=1
  18. elif command == "Double":
  19. total_score = 2*reached_score
  20. if total_score <= score:
  21. score -= total_score
  22. shots_counter_success += 1
  23. else:
  24. score = score
  25. shots_counter_unsuccess += 1
  26. elif command == "Triple":
  27. total_score = reached_score * 3
  28. if total_score <= score:
  29. score -= total_score
  30. shots_counter_success += 1
  31. else:
  32. score = score
  33. shots_counter_unsuccess += 1
  34. if score == 0:
  35. print(f"{name} won the leg with {shots_counter_success} shots.")
  36. break
  37. command = input()
  38. if command == "Retire":
  39. print(f"{name} retired after {shots_counter_unsuccess} unsuccessful shots.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement