Search Header Logo
For Loops and Range Function

For Loops and Range Function

Assessment

Presentation

Computers

9th - 10th Grade

Medium

Created by

Calum Gordon

Used 19+ times

FREE Resource

15 Slides • 16 Questions

1

For Loops and Range Function

Count-controlled Loops

media

2

media

3

media

4

Multiple Select

By the end of this lesson you should be able to ....

1

use the range() function

2

create for loops over a range of integers

3

create while loops

4

define functions

5

media

6

Multiple Choice

Why do we need to have loops anyway in a computer program?

1

To avoid needless repetition of lines of code

2

To make the code much cooler

3

To show off your coding skills

4

To put code into the correct order

7

media

8

Multiple Choice

range() is an example of a ___________ in Python

1

data structure

2

key word

3

function

4

variable

9

media

10

Multiple Choice

Question image

Which line of code would create the output shown?

1

print(list(range(12)))

2

print(list(range(11)))

3

list(range(12))

4

range(11)

11

media

12

Fill in the Blank

Values that are provided as inputs to a function when it is called?

13

Multiple Choice

Question image

Which line of code would produce the output shown?

1

print(list(range(2,22,2)))

2

print(list(range(2,20)))

3

print(list(range(0,22)))

4

print(list(range(1,21,2)))

14

media

15

Multiple Choice

What type of loop is a 'for' loop?

1

Conditional

2

Count-controlled

3

Infinite

4

Nested

16

media

17

Multiple Choice

Question image

Identify the loop variable in this loop?

1

i

2

j

3

k

4

num

18

media

19

Fill in the Blank

Word used to describe the action of using a for loop to repeat an action over every item in a list?

20

media

21

Multiple Choice

Question image

What will the output be from this loop?

1

All the colours in list printed on the same line

2

No output

3

All the colours in list printed out, each on a new line

4

Every letter in 'colours' printed on a new line

22

media

23

media

24

Multiple Choice

How do you think a 'for' loop is represented in a flow chart?

1

Decision symbol with option to loop back

2

Decision symbol with no loop back ooption

3

It is not represented

4

Multiple decisions one after another

25

media

26

media

27

Multiple Select

Two ways to use a for loop?

1

To iterate over a specific range of integers

2

To iterate over all the items in a data structure

3

To iterate as long as a condition is True

4

To iterate until a condition becomes False

28

Multiple Choice

The range function generates a series of ___________ from start to stop.

1

integers

2

numbers

3

lists

4

strings

29

Fill in the Blank

It can include an optional parameter to specify the step size. If this is omitted the default step size is ________

30

Open Ended

Question image

Thinking Hard

What have you learnt today?

What can you do with this knowledge/skill/understanding?

What do you still need to know?

(press Shift+Enter to take a new line ...)

31

Poll

How much of this lesson have you understood?

None of it

Some of it

Most of it

All of it

For Loops and Range Function

Count-controlled Loops

media

Show answer

Auto Play

Slide 1 / 31

SLIDE