Advertisement
biswasrohit20

pi

May 9th, 2021
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. # Import the random Module
  2. import random
  3.  
  4. # Here are your list of Pirates
  5. pirates = [
  6. 'Captain William Kidd',
  7. 'Pierre Le Grand',
  8. 'Red Leg Grieves',
  9. 'Edward Low',
  10. 'Calico Jack Rackham',
  11. 'Anne Bonny',
  12. 'Captain Henry Morgan',
  13. 'Black Sam Bellamy',
  14. 'Black Bart Roberts',
  15. 'Edward Blackbeard Teach']
  16.  
  17. # PRINT THE CONTENT OF THE PIRATES LIST TO THE SCREEN HERE
  18. print(pirates)
  19. # Attacks List
  20. attack = ['dodge', 'parry', 'thrust']
  21.  
  22. # PRINT THE CONTENTS OF THE ATTACK LIST TO THE SCREEN HERE
  23. print(attack)
  24. # Choosing the Characters for the fight
  25. player = random.choice(pirates)
  26. opponent = random.choice(pirates)
  27.  
  28. # #############################################################################
  29. # Change the line below to correctly concatenate PLAYER and OPPONENT with
  30. # the variables above so that when the statement prints to screen, the chosen
  31. # character names are shown.
  32. # #############################################################################
  33.  
  34. print("Ahoy ye swabs! Prepare for battle!")
  35. print(player + " has challenged " + opponent + " in one on one combat!")
  36.  
  37. # Choosing the attack
  38. pattack = random.choice(attack)
  39. oattack = random.choice(attack)
  40.  
  41. # CREATE A CORRECTLY CONCATENATED STRING THAT CONTAINS PLAYER, OPPONENT, PATTACK & OATTACK
  42. print(player + " uses " + pattack + " and " + opponent + " uses " + oattack)
  43.  
  44. if pattack == oattack:
  45. print("It's a draw.")
  46. elif pattack == "dodge" and oattack == "parry":
  47. print(player + " won the match.")
  48. elif pattack == "parry" and oattack == "thrust":
  49. print(player + " won the match.")
  50. elif pattack == "thrust" and oattack == "dodge":
  51. print(player + " won the match.")
  52.  
  53. elif oattack == "dodge" and pattack == "parry":
  54. print(opponent + " won the match.")
  55. elif oattack == "parry" and pattack == "thrust":
  56. print(opponent + " won the match.")
  57. elif oattack == "thrust" and pattack == "dodge":
  58. print(opponent + " won the match.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement