Lecture
Coding Quiz
This coding quiz requires 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]
Lessons in this chapter Β· For Loop: Structure and Usage
- 1. How to Perform Iterations Based on Conditions in Python
- 2. Using `for` loops with Lists
- 3. Nested Lists and Nested Loops
- 4. Multiple-choice quiz
- 5. Expanding Sequence Elements with the Spread Operator
- 6. Utilizing for Loops with Dictionaries
- 7. How to Create a Range of Numbers in Python
- 8. Coding Quiz - for Loop
- 9. Multiple-choice quiz
- 10. Fill-in-the-blank quiz
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help