We are working on counting the number of elements in the 3D string list and using that number.
eleli = [[["ele", "ele", "ele", "ele", "ele"], ["ele", "ele", "ele"]], [["ele", "ele", "ele", "ele", "ele"], ["ele", "ele", "ele", "ele"]], [["ele", "ele", "ele", "ele"], ["ele", "ele", "ele", "ele", "ele"]], [["ele", "ele"]]]
print(len(eleli))
>>>4
Is there a simple way to count all string elements in a list?
>Solution :
Yes, there is:
print(sum(len(e) for seq in eleli for e in seq))