Python Basics
Loop Concepts
For Loops
While Loops
Jump Statements
100

This function displays output on the screen.

print()

100

A programming structure used to repeat instructions.

Loop

100

The keyword used to start this loop.

for

100

The keyword used to create this loop.

while

100

This statement immediately exits a loop.

break

200

This function allows the user to enter data.

input()

200

Python has two main loops taught in this course.

for and while

200

This function generates a sequence of numbers for loops.

range()

200

This controls whether the loop continues running.

Condition

200

This statement skips the current iteration and continues to the next.

continue

300

This symbol assigns a value to a variable.

=

300

This loop repeats code while a condition is true.

while loop

300

How many times will this run? 

for i in range(5)

5

300

What happens if the condition never becomes false?

Infinite loop

300

What will be printed? 

for i in range(5): 

     if i==3: 

     break 

     print(i)

0 1 2

400

This data type stores whole numbers.

int

400

This loop is usually used with range() to repeat a certain number of times.

for loop

400

What is the last value of i? 

for i in range(1,6)

5

400

What will be printed? 

x=1

while x<=3: 

        print(x) 

        x+=1

1 2 3

400

What will be printed? 

for i in range(5): 

     if i==2: 

     continue 

     print(i)

0 1 3 4

500

This function converts input into a whole number.

int()

500

A loop that never stops running.

Infinite loop

500

How many iterations occur? 

for x in range(2,10,2)

4 iterations (2,4,6,8)

500

How many times will this loop run? 

x=4

while x>0: 

        x-=1

4 times

500

What will be printed? 

for i in range(1,6): 

     if i==4: 

     break 

     print(i)

1 2 3

M
e
n
u