Files

41 lines
879 B
Markdown

---
id: practical-python-2.13
source_exercise_id: "2.13"
title: "Counting"
section: "2.4 Sequences"
source_path: "02_Working_with_data/04_Sequences.md"
source_repo: "https://github.com/dabeaz-course/practical-python"
source_commit: "93dca856b41c61a0a0f85ae334116e4c125629ea"
student_visible_solution: false
has_private_solution: false
skip: false
---
# Exercise 2.13: Counting
> Source: Practical Python Programming, `02_Working_with_data/04_Sequences.md`.
### Exercise 2.13: Counting
Try some basic counting examples:
```python
>>> for n in range(10): # Count 0 ... 9
print(n, end=' ')
0 1 2 3 4 5 6 7 8 9
>>> for n in range(10,0,-1): # Count 10 ... 1
print(n, end=' ')
10 9 8 7 6 5 4 3 2 1
>>> for n in range(0,10,2): # Count 0, 2, ... 8
print(n, end=' ')
0 2 4 6 8
>>>
```
## 关联来源
- [[summaries/04_Sequences]]