ниже
Объяснение:
import random
while True:
sum_of_smaller = 0
formated_aray = []
source_array = []
for n in range(15):
random_number = random.randint(0,1000)
source_array.append(random_number)
for element in source_array:
formated_aray.append(element + source_array.index(element))
while True:
a = int(input('Введите число: '))
for el in formated_aray:
if el < a:
sum_of_smaller += el**2
else:
pass
break
print(source_array)
print(sum_of_smaller)
В любом онлайн компилятор. Или в Netbeans