Advertisement
Spocoman

03. Heart Delivery

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