snow27

Untitled

Feb 8th, 2021
593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.39 KB | None | 0 0
  1.  
  2. def check_successfully(corresponding):
  3.     count = 0
  4.     for key in corresponding:
  5.         if corresponding[key] >= 3:
  6.             count += 1
  7.     if count == 3:
  8.         return True
  9.     else:
  10.         return False
  11.  
  12.  
  13. bomb_corresponding = {40: 0, 60: 0, 120: 0}
  14. bomb_effects = list(map(int, input().split(", ")))
  15. bomb_casing = list(map(int, input().split(", ")))
  16. is_successfully = False
  17. while len(bomb_effects) != 0 or len(bomb_casing) != 0:
  18.     if check_successfully(bomb_corresponding):
  19.         is_successfully = True
  20.         break
  21.     sum_of_effects_and_casing = bomb_effects[0] + bomb_casing[-1]
  22.     if sum_of_effects_and_casing in bomb_corresponding:
  23.         bomb_corresponding[sum_of_effects_and_casing] += 1
  24.         bomb_effects.pop(0)
  25.         bomb_casing.pop()
  26.     else:
  27.         bomb_casing[-1] -= 5
  28.  
  29. if is_successfully:
  30.     print("Bene! You have successfully filled the bomb pouch!")
  31. else:
  32.     print("You don't have enough materials to fill the bomb pouch.")
  33.  
  34. if len(bomb_effects) == 0:
  35.     print("Bomb Effects: empty")
  36. else:
  37.     print(f"Bomb Effects: {', '.join(map(str, bomb_effects))}")
  38.  
  39. if len(bomb_casing) == 0:
  40.     print("Bomb Casings: empty")
  41. else:
  42.     print(f"Bomb Casings: {', '.join(map(str, bomb_casing))}")
  43.  
  44. print(f"Cherry Bombs: {bomb_corresponding[60]}")
  45. print(f"Datura Bombs: {bomb_corresponding[40]}")
  46. print(f"Smoke Decoy Bombs: {bomb_corresponding[120]}")
  47.  
Advertisement
Add Comment
Please, Sign In to add comment