Advertisement
Nenogzar

Untitled

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