Advertisement
bl00dt3ars

10. Heart Delivery

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