Skip to content

Commit

Permalink
For loop
Browse files Browse the repository at this point in the history
  • Loading branch information
s2t2 committed Sep 11, 2024
1 parent 8abf3d7 commit 28c8448
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/notes/data-processing/for-loops.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ We have no choice but to put the list we want to loop through in the second slot
```{python}
symbols = ["MSFT", "AAPL", "GOOGL", "AMZN", "NFLX"]
for x in symbols: # IF WE USE X HERE IN THE FIRST SLOT...
for x in symbols:
print("--------")
print(x) # ... WE HAVE TO REFERENCE X HERE AS WELL
print(x)
# NOTHING ELSE, GO TO NEXT ITEM
print("BOTTOM")
Expand All @@ -66,9 +66,9 @@ As a best practice, if we have a list of items plural (e.g. `symbols`), we could
```{python}
symbols = ["MSFT", "AAPL", "GOOGL", "AMZN", "NFLX"]
for symbol in symbols: # IF WE USE SYMBOL HERE IN THE FIRST SLOT...
for symbol in symbols:
print("--------")
print(symbol) # ... WE HAVE TO REFERENCE SYMBOL HERE AS WELL
print(symbol)
# NOTHING ELSE, GO TO NEXT ITEM
print("BOTTOM")
Expand Down

0 comments on commit 28c8448

Please sign in to comment.