GeorgiLukanov87

index extracting nested loop

Apr 8th, 2022 (edited)
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. num1 = input()
  2. num2 = input()
  3.  
  4. start1 = num1[0]
  5. start2 = num1[1]
  6. start3 = num1[2]
  7. start4 = num1[3]
  8.  
  9. end1 = num2[0]
  10. end2 = num2[1]
  11. end3 = num2[2]
  12. end4 = num2[3]
  13.  
  14. for x1 in range(int(start1), int(end1) + 1):
  15.     for x2 in range(int(start2), int(end2) + 1):
  16.         for x3 in range(int(start3), int(end3) + 1):
  17.             for x4 in range(int(start4), int(end4) + 1):
  18.                 if x1 % 2 != 0 and x2 % 2 != 0 and x3 % 2 != 0 and x4 % 2 != 0:
  19.                     print(f"{x1}{x2}{x3}{x4}", end=' ')
Add Comment
Please, Sign In to add comment