Show Menu

Statements and Loops Cheat Sheet by

loops     statements

If Else Statements

if
Passes into code if True
elif
If last statement was not True, check this statement
else
If all statements prior were False, handle this statement as True

For Loops

for i in range(­num):
From 0 to num-1, do
for i in range(­len­(li­st)):
From 0 to length of list-1
for item in list:
Iterates through each item in collection data type
 

Control Statements

break
Exits loop
continue
Moves to next Iteration
pass
Placeh­older

While Loops

while statement:
Continues until statement is False
while 1:
Continues until statement is False
while True:
Continues until statement if False

Download the Statements and Loops Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/crystinvw_statements-and-loops.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          PHP Syntax for beginners Cheat Sheet

          More Cheat Sheets by crystinvw