Skip to content

Commit 1baa8c8

Browse files
committed
minor fix
1 parent f6c504b commit 1baa8c8

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

docs/python/python-loops.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -244,25 +244,6 @@ else:
244244
print("While loop finished!")
245245
```
246246

247-
## List Comprehensions (Advanced)
248-
249-
A concise way to create lists using loops.
250-
251-
```python
252-
# Traditional approach
253-
squares = []
254-
for x in range(5):
255-
squares.append(x ** 2)
256-
257-
# List comprehension
258-
squares = [x ** 2 for x in range(5)]
259-
print(squares) # [0, 1, 4, 9, 16]
260-
261-
# With condition
262-
even_squares = [x ** 2 for x in range(10) if x % 2 == 0]
263-
print(even_squares) # [0, 4, 16, 36, 64]
264-
```
265-
266247
## Common Loop Patterns
267248

268249
### Counting Pattern

0 commit comments

Comments
 (0)