GeorgiLukanov87

change the player nested loops

Apr 10th, 2022 (edited)
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. K = int(input())
  2. L = int(input())
  3. M = int(input())
  4. N = int(input())
  5. condition = False
  6. counter = 0
  7. for a1 in range(K, 8 + 1):
  8.     if condition:
  9.         break
  10.     for a2 in range(9, L - 1, -1):
  11.         if condition:
  12.             break
  13.         for b1 in range(M, 8 + 1):
  14.             if condition:
  15.                 break
  16.             for b2 in range(9, N - 1, -1):
  17.  
  18.                 if a1 % 2 == 0 and b1 % 2 == 0 and a2 % 2 != 0 and b2 % 2 != 0:
  19.                     if a1 == b1 and a2 == b2:
  20.                         print("Cannot change the same player.")
  21.                     else:
  22.                         print(f"{a1}{a2} - {b1}{b2}")
  23.                         counter += 1
  24.                     if counter == 6:
  25.                         condition = True
  26.                         break
  27.  
Add Comment
Please, Sign In to add comment