I'm trying to print the product of all elements of an array with len(array) - 1. e.g. array = ['1','10','11']; so 10*11 since 10 and 11 have a length = 2.
I've written the following code but can't seem to find the issue (I keep receiving a 'None').
import numpy
def fun(array):
length = len(array) - 1; " find length of the array "
for i in range(0,length+1):
if len(array[i]) == length:
"""find elements in array with len == length"""
new_array = []
new_array.append(array[i])
"add these elements into a new array"
for j in range(0,len(new_array)):
return numpy.prod(int(new_array[j]))
"find the product of these elements and return them"
else: break
else: break
Any help will be appreciated.