wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python lists

Total questions: 7

Worksheet time: 5mins

Name
Class
Date
1.

What is the printed?

grades=[ ]

grades.append(45)

grades.append(67)

grades.append(35)

grades.append(21)

print(grades)

a)

[45, 67, 35, 21 ]

b)

[35, 67, 45, 21]

c)

[ ]

d)

Nothing

2.

What does Append do in python?

a)

Add (something) as an attachment or supplement.

b)

Append is to join or add on to the end of something.

c)

Attach

d)

Take away a number.

3.

What is printed?

list=[1, 2, 3, 4]

length=(len(list))

print(length)

a)

4

b)

3

c)

2

d)

1

4.

What does the reverse function do in python?

a)

Nothing

b)

Reverses the list

c)

Move Backwards

d)

Going in or turned toward the direction opposite to that previously stated.

5.

What is the printed?

grades=[21, 35, 67, 45, 99, 51]

grades.sort()

print(grades)

a)

[21, 35, 67, 45, 99, 51]

b)

[21, 35, 45, 51, 67, 99]

c)

[21, 35, 45, 67, 51, 99]

d)

Nothing

6.

What is the printed?

grades=[21, 35, 67, 45, 99, 51]

grades.remove(67)

print(grades)

a)

[21, 35, 45, 99, 51]

b)

[21, 35, 45, 67, 99]

c)

[67, 35, 51, 45, 99]

d)

Nothing

7.

What does the slice do in python?

a)

A thin, broad piece of food, such as bread, meat, or cake, cut from a larger portion.

b)

A stroke that makes the ball curve away to the right (for a left-handed player, the left), typically inadvertently.

c)

Cut a Cucumber

d)

Extracts elements, based on a start and stop.