Answer:
def total_lengths(string_list):
total = 0
for s in string_list:
l = len(s)
total = total + l
return total
a_list = ["black", "blue", "white"]
print(total_lengths(a_list))
Step-by-step explanation:
Inside the function:
- Initialize total to zero to hold the sum
- In the for loop, assign the length of the each string to the l and add these values to the total
Then
- Create a list to check the function
- Call the function, pass the list as a parameter and print the result