![](https://otvet.imgsmail.ru/download/196127919_ecb9279e2c434b629f7cea095fea14df_800.png)
Вот эти вот двойные кавычки
Можно либо до цикла объявить либо в случае else:
positions = [] # Create a list to store the positions
for N in range(1000, 10000):
n = list(map(int, str(N)))
g1 = int(n[0]) + int(n[1])
g2 = int(n[1]) + int(n[2])
g3 = int(n[2]) + int(n[3])
if g1 < g2 and g1 < g3 and g2 < g3:
del(g1)
w = int(str(g2) + str(g3))
elif g1 < g2 and g1 < g3 and g3 < g2:
del(g1)
w = int(str(g3) + str(g2))
elif g2 < g1 and g2 < g3 and g1 < g3:
del(g2)
w = int(str(g1) + str(g3))
elif g2 < g1 and g2 < g3 and g3 < g1:
del(g2)
w = int(str(g3) + str(g1))
elif g3 < g1 and g3 < g2 and g2 < g1:
del(g3)
w = int(str(g2) + str(g1))
elif g3 < g1 and g3 < g2 and g1 < g2:
del(g3)
w = int(str(g1) + str(g2))
else:
print("ha")
w = 0
if w == 1315:
positions.append(N) # Add the position to the list
# Print the positions after the loop
print(f"Позиции числа 1315: {positions}")
Moo LinaУченик (75)
2 дня назад
Ого, компактно
Даже не знала, что в одной строке можно несколько переменных создать
Благодарствую, обязательно разберу отсюда всё, что впервые вижу