Iteration
touch src/iteration.py tests/test_iteration.pyWrite the test first
from src.iteration import print_all_items
class TestIteration:
def test_loops_over_list(self):
"""
Given a list of strings
When `print_all_items()` is called
Then each item is printed
"""
# Given
items = ["red", "blue", "green"]
# When / Then
print_all_items(items=items)Implement the iteration
Looping over dictionaries
Looping over generators
References
Last updated