bl00dt3ars

10. Heart Delivery (Todor Krumov Popov)

Jun 14th, 2021 (edited)
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. neighborhood = [int(x) for x in input().split("@")]
  2. default_index = 0
  3. while True:
  4.     command = input()
  5.     if command == "Love!":
  6.         print(f"Cupid's last position was {default_index}.")
  7.         if neighborhood.count(0) < len(neighborhood):
  8.             print(f"Cupid has failed {len(neighborhood)- neighborhood.count(0)} places.")
  9.         else:
  10.             print("Mission was successful.")
  11.         break
  12.     command = command.split()
  13.     default_index += int(command[1])
  14.     if default_index > len(neighborhood)-1:
  15.         default_index = 0
  16.     if neighborhood[default_index] == 0:
  17.         print(f"Place {default_index} already had Valentine's day.")
  18.     else:
  19.         neighborhood[default_index] -= 2
  20.         if neighborhood[default_index] == 0:
  21.             print(f"Place {default_index} has Valentine's day.")
Add Comment
Please, Sign In to add comment