Sichanov

lucky_numbers

Dec 21st, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. number = int(input())
  2.  
  3. for i in range(1000, 10000):
  4.     string_i = str(i)
  5.     if string_i[1] != str(0) and string_i[2] != str(0) and string_i[3] != str(0):
  6.         sum_first_two = int(string_i[0]) + int(string_i[1])
  7.         sum_second_two = int(string_i[2]) + int(string_i[3])
  8.         if sum_first_two == sum_second_two:
  9.             if number % sum_first_two == 0:
  10.                 print(f'{string_i}', end=" ")
  11.  
Advertisement
Add Comment
Please, Sign In to add comment