SHOW:
|
|
- or go back to the newest paste.
1 | # if you want to iterate over multiple ranges/lists in sequence: | |
2 | ||
3 | for i in range(0, 180, 45): | |
4 | print(i) | |
5 | for i in range(180, 0, -45): | |
6 | print(i) | |
7 | for i in [0]: | |
8 | print(i) | |
9 | ||
10 | ||
11 | # use the "chain" function from itertools to combine the ranges/lists: | |
12 | ||
13 | from itertools import chain | |
14 | ||
15 | for i in chain( range(0, 180, 45), range(180, 0, -45), [0] ): | |
16 | print(i) |