GeorgiLukanov87

nested loops exam basics

Apr 11th, 2022 (edited)
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 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. is_same = False
  7. for num1 in range(k, 9):
  8.     if counter_subs == 6:
  9.         break
  10.     for num2 in range(9, l - 1, -1):
  11.         if counter_subs == 6:
  12.             break
  13.         for num3 in range(m, 9):
  14.             if counter_subs == 6:
  15.                 break
  16.             for num4 in range(9, n - 1, -1):
  17.                 if num1 == num3 and num2 == num4 and num1 != num2:
  18.                     is_same = True
  19.                     print(f"Cannot change the same player.")
  20.                     continue
  21.                 if num1 % 2 == 0 and num3 % 2 == 0 and num2 % 2 != 0 and num4 % 2 != 0:
  22.                     counter_subs += 1
  23.                     print(f"{num1}{num2} - {num3}{num4}")
  24.                 if counter_subs == 6:
  25.                     break
  26.             if is_same:
  27.                 continue
  28.         if is_same:
  29.             continue
  30.     if is_same:
  31.         continue
  32.  
Add Comment
Please, Sign In to add comment