Advertisement
go6odn28

The song of the wheels

Oct 13th, 2023
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. control_number = int(input())
  2. counter = 0
  3. password = 0
  4. fourth_num = False
  5.  
  6. for a in range(1, 10):
  7.     for b in range(1, 10):
  8.         for c in range(1, 10):
  9.             for d in range(1, 10):
  10.                 needed_num = (a * b) + (c * d)
  11.  
  12.                 if a < b and c > d and needed_num == control_number:
  13.                     print(f"{a}{b}{c}{d} ", end="")
  14.                     counter += 1
  15.  
  16.                     if counter == 4:
  17.                         password = 1000 * a + 100 * b + 10 * c + d
  18.                         fourth_num = True
  19.  
  20. print()
  21.  
  22. if fourth_num:
  23.     print(f"Password: {password}")
  24. else:
  25.     print("No!")
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement