enter image description here
The condition of the problem in the image.
The following code turns out, it does not give anything, if you take a larger number in the loop, it gives an answer, but it is incorrect. I tried to fix it, change it, nothing comes out(
for n in range(1, 1_000_000):
s1 = 0
for num1 in str(n):
if int(num1) % 2 == 0:
s1 += int(num1)
s2 = 0
len_n = len(str(n))
for i in range(1, len_n):
if i % 2 != 0:
s2 += int(str(n)[i])
if abs(s2 - s1) == 26:
print(n)
break
New contributor
Михаил Сухарев is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1