def suma_poteg(lista): for e in lista: if type(e) is not int and type(e) is not float: return False wynik = 0 for x, a in enumerate(lista): wynik += a ** x return wynik # przykładowe wykonania print(suma_poteg([-2, -3, -4, 1])) # 15 print(suma_poteg([-2, "-3", -4, 1])) # False print(suma_poteg([-2, -3.5, -4, 1.4])) # 16.244