python3
for
loop with a list>>> for fruit in ["apple", "peach", "blueberry", "watermelon"]: ... print(fruit) ...
range
function>>> for number in range(5): ... print(number, end=', ') ... >>> for number in (1, 6): ... print(number, end=', ') ... >>> for number in (1, 6, 2): ... print(number, end=', ') ... >>> for number in (5, 0, -1): ... print(number, end=', ') ...
apple peach blueberry watermelon 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 3, 5, 7, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,
cd it116
cd ex
mkdir ex10
ls
cd it116/ex/ex10
python3 ex10.py
apple peach blueberry watermelon 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 3, 5, 7, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,
~ghoffman/it116_test/ex10.shThe script will prompt you for your Unix username.