Advertisement
bl00dt3ars

Heart Delivery

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