GeorgiLukanov87

exam basics nested looping

Apr 11th, 2022 (edited)
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. k = int(input())
  2. l = int(input())
  3. m = int(input())
  4. n = int(input())
  5. counter_subs = 0
  6. all_printed = False
  7. for num1 in range(k, 9):
  8.     for num2 in range(9, l - 1, -1):
  9.         for num3 in range(m, 9):
  10.             for num4 in range(9, n - 1, -1):
  11.                 if num1 % 2 == 0 and num3 % 2 == 0 and num2 % 2 != 0 and num4 % 2 != 0:
  12.                     if num1 == num3 and num2 == num4:
  13.                         print(f"Cannot change the same player.")
  14.                         continue
  15.                     else:
  16.                         print(f"{num1}{num2} - {num3}{num4}")
  17.                         counter_subs += 1
  18.                         if counter_subs == 6:
  19.                             all_printed = True
  20.                             break
  21.  
Add Comment
Please, Sign In to add comment