Advertisement
Guest User

Dating App

a guest
Jun 26th, 2020
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. from collections import deque
  2.  
  3. males = list(map(int, input().split()))
  4. females = deque(map(int, input().split()))
  5.  
  6. matches = 0
  7.  
  8. while males and females:
  9.     current_male = males.pop()
  10.     current_female = females.popleft()
  11.  
  12.     if current_male <= 0:
  13.         females.insert(0, current_female)
  14.         continue
  15.     if current_female <= 0:
  16.         males.append(current_male)
  17.         continue
  18.  
  19.     if current_male % 25 == 0:
  20.         males.pop()
  21.         females.append(current_female)
  22.         continue
  23.     elif current_female % 25 == 0:
  24.         females.popleft()
  25.         males.append(current_male)
  26.         continue
  27.  
  28.     if current_male == current_female:
  29.         matches += 1
  30.     elif current_male != current_female:
  31.         males.append(current_male - 2)
  32.  
  33. print(f"Matches: {matches}")
  34.  
  35. if males:
  36.     print(f"Males left: {(', '.join(map(str, reversed(males))))}")
  37. else:
  38.     print(f"Males left: none")
  39.  
  40. if females:
  41.     print(f"Females left: {(', '.join(map(str, females)))}")
  42. else:
  43.     print(f"Females left: none")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement