Ответ:
a=[2.35,-4.15,0,-3.1, 7.8, 6.3,-3.05,1.5]
s=1
k=0
for i in a:
if i>0:
s*=i
k+=1
s=s**(1/k)
print(s)
n=-1
for i in range(len(a)):
if a[i]>0:
if n==-1:
n=abs(s-a[i])
j=i
if abs(s-a[i]) < n:
print(j)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
Ответ:
a=[2.35,-4.15,0,-3.1, 7.8, 6.3,-3.05,1.5]
s=1
k=0
for i in a:
if i>0:
s*=i
k+=1
s=s**(1/k)
print(s)
n=-1
for i in range(len(a)):
if a[i]>0:
if n==-1:
n=abs(s-a[i])
j=i
if abs(s-a[i]) < n:
n=abs(s-a[i])
j=i
print(j)