Title: For Loop
Slug: for_loops
Summary: For Loop
Date: 2016-05-01 12:00
Category: Python
Tags: Basics
Authors: Chris Albon

The for loop iterates over each item in a sequences.


In [2]:
# One at a time, assign each value of the sequence to i and,
for i in [432, 342, 928, 920]:
    # multiply i by 10 and store the product in a new variable, x create a new variable, x,
    x = i * 10
    # print the value of x
    print(x)
# after the entire sequence processes,
else:
    # print this
    print('All done!')


4320
3420
9280
9200
All done!