Understanding Python For Loops

Understanding Python For Loops

Assessment

Interactive Video

Computers

6th - 8th Grade

Hard

Created by

Jennifer Brown

FREE Resource

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the default step value when using the range function in a for loop?

10

0

1

2

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If you want to count by twos starting from 1 using a for loop, which range function would you use?

range(1, 10, 1)

range(2, 10, 2)

range(1, 10, 2)

range(0, 10, 2)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you modify the range function to count only even numbers between 0 and 10?

range(2, 10, 2)

range(1, 10, 2)

range(0, 10, 2)

range(0, 10, 1)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens when you use a negative step value in the range function?

It counts backwards by the positive value.

It counts forwards by the negative value.

It counts forwards by the positive value.

It counts backwards by the negative value.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which range function would you use to create a countdown from 10 to 1?

range(10, 1, -1)

range(10, 0, -1)

range(10, 1, 1)

range(10, 0, 1)