Skip to content

Commit bbfbda4

Browse files
committed
feat: Add more details to the iteration slide in slides/weektwo/index.qmd.
1 parent acb8f02 commit bbfbda4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

slides/weektwo/index.qmd

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,30 +96,27 @@ print(format_document_title("user guide", True) + " / "
9696

9797
:::
9898

99-
## Iteration: Repeat an operation a specific number of times
99+
## Iteration: Repeat an operation
100100

101101
```{python}
102102
def count_words_in_documents(documents: list) -> dict:
103103
"""Count total words across multiple documents."""
104104
word_counts = {}
105105
for doc_name in documents:
106-
# simulate getting word count for each document
107106
word_count = len(doc_name.split()) # simple word count
108107
word_counts[doc_name] = word_count
109108
return word_counts
110109
111110
# test with sample document names
112-
docs = ["User Manual", "Installation Guide", "API Reference"]
111+
docs = ["Manual", "Installation Guide", "API Reference Document"]
113112
counts = count_words_in_documents(docs)
114113
print(counts)
115114
```
116115

117-
::: {.incremental .fade style="margin-top: 0.5em; font-size: 0.925em;"}
116+
::: {.incremental .fade style="margin-top: -0.25em; font-size: 0.8em;"}
118117

119118
- `word_counts` is a dictionary that starts out empty
120-
- `documents` is a list of document names
121119
- The `for` loop iterates through each document name in the list
122-
- The body of the loop counts words and stores result in dictionary
123120
- **Document connection**: analyzing multiple documents in a collection!
124121

125122
:::

0 commit comments

Comments
 (0)