for loop

TheΒ 
forΒ 
loopΒ 
iteratesΒ 
overΒ 
aΒ 
sequence
Β 
(thatΒ 
isΒ 
aΒ 
list,Β 
tuple,Β 
dictionary,Β 
set,Β 
orΒ 
aΒ 
string)
WeΒ 
useΒ 
aΒ 
variableΒ 
toΒ 
createΒ 
theΒ 
forΒ 
loop,Β 
whichΒ 
isΒ 
calledΒ 
theΒ 
LoopΒ 
variable
.Β 
ThereΒ 
areΒ 
twoΒ 
waysΒ 
toΒ 
createΒ 
theΒ 
ForΒ 
loop.Β 
OneΒ 
isΒ 
withΒ 
theΒ 
range()Β 
method
,Β 
andΒ 
theΒ 
otherΒ 
isΒ 
withoutΒ 
usingΒ 
theΒ 
range()Β 
method.

for loop with range()

UsingΒ 
theΒ 
range()
Β 
method,Β 
youΒ 
canΒ 
specifyΒ 
aΒ 
startingΒ 
number
Β 
andΒ 
anΒ 
endingΒ 
number
.Β 
TheΒ 
loopΒ 
willΒ 
runΒ 
thoseΒ 
manyΒ 
times,Β 
andΒ 
inΒ 
eachΒ 
cycle,Β 
theΒ 
loopΒ 
variableΒ 
willΒ 
holdΒ 
thoseΒ 
numbers
.
for loop_variable in range(start, end):
    <statements>
#the loop runs from start to end-1
for num in range(0, 5):
    print(num)

for loop without range()

WithoutΒ 
theΒ 
rangeΒ 
method,Β 
aΒ 
forΒ 
loopΒ 
canΒ 
iterateΒ 
overΒ 
letters
Β 
inΒ 
aΒ 
string,Β 
elements
Β 
inΒ 
aΒ 
list,Β 
tuple,Β 
orΒ 
aΒ 
dictionaryΒ 
asΒ 
well.
for loop_variable in string_variable:
    <statements>
word = 'bumfuzzle'
for letter in word: #In loop 1, letter = 'b'
    print(letter)