def checkio(array: list) -> int:
n= len(array)
if n== 1:
res= array[0]**2
elif n == 0:
res = 0
else:
if n%2 ==0:
c=0
for i in array:
c+= i+(i+2)
res= c*array[-1]
else:
k= 0
for i in range(n):
k+= i+(i+2)
res= k*array[-1]
return res
Created at: 2021/07/17 22:53; Updated at: 2021/07/19 11:10