Coding Quiz
This coding quiz involves writing a function that uses Python's for
loop and lists to process each element sequentially.
Pass a list of strings as input to the solution
function, and write Python code that outputs the length of each string in the list.
Parameter Format
def solution(strings): # Write your code here return
Constraints
-
The input must be a list of strings.
-
Each element in the list must be a non-empty string.
Example Input and Output
-
Input:
["hello", "world", "python"]
-
Output:
[5, 5, 6]
Mission
0 / 1
Write Python code to calculate the length of each element in a list of strings.
def solution(strings):
lengths = []
for string in :
lengths.append(len(string))
return lengths
strings
string
lengths
len
Guidelines
AI Tutor
Publish
Design
Upload
Notes
Favorites
Help