Loops 1
Loops 2
Loops 3
Loops 4
100

A command that will allow code to repeat over and over

What is a Loop? 


100

Unless otherwise specified, for loops start at this number.

0

100

What/where is the error in the code?:

while coin.upper() != "Done"

    coin = input("Insert a coin, Q(Quarter), D(Dime), N(Nickel), or P(Penny). Then type F(Finish) when done. ")

    if coin.upper() == "Q":

        total = total + Q

    elif coin.upper() == "D":

        total = total + D

    elif coin.upper() == "N":

        total = total + N

missing a colon in the while statement 

100

How would a reverse range look like where you print out numbers using a negative step where the start = 5 and the stop = -1

5

4

3

2

1

0

200

A type of loop that we do not know the exact # of times it will continue for

What is a While Loop

200

This is the way you phrase a loop that should go 10 times.  

What is "for i in range (10)"?

200

for i in range(4): 

  print(i)

What will Python print?

0

1

2

3

200

What should be the condition that is missing from the following code segment:

age = int(input("Enter your age: "))

if ___________:
    print("Eligible for voting)"

else:

    print("Not eligible for voting")

age >= 18

300

A While Loop that never ends

What is an Infinite Loop?

300

What comes after a while loop?

a conditional statement

300

100

number = 5

if (number > 10):

    print("Hello!")

else:

    print("Bye-bye")

What will Python print?

Bye-bye

300

How many times will this loop run?

for i in range(3):

    for j in range(5):

            print((i+1) * (j+1))

15

400

A type of loop that only continues for a set amount of times.

What is a For Loop?

400

A function that repeats a block of code in a specified order, often until a specific result occurs.

What is iteration?

400

How many times would "meow" print:

for i in range(2, 10, 2):

   print("meow")

4

400

How many times will "meow" print out:

i = 3

while (i > 3):

   print("meow")

   i -= 1

0

500

A function that has a start and end value

What is a range?

500

How many times would this loop run?

x = 0

while x < 5:

      x = x + 1

5

500

This value can be added to the range for a loop to count backwards.

What is -1?

500

What is the output of the following program:

for i in range (1,11,3):

    if i%2==0:

        print (i)

4

10