wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

python l.2

Total questions: 10

Worksheet time: 46mins

Name
Class
Date
1.

numbers = [5, 14, 9, 17]

for number in numbers:

if number % 3 == 0:

print(number)


The output will be?

a)

17

b)

9

c)

14

9

17

d)

14

17

2.
What will be printed after running this FOR loop:

for number in range(6):
 
    print(number)
a)
The number 6 
b)
The numbers 0 - 5
c)
The number 5
d)
The numbers 1 - 6
3.

What is the index of “grape” in the list

[“apple”, “grape”, “orange”, “watermelon”]?

a)

0

b)

1

c)

2

d)

3

4.

What is the result of the following condition if:

A = 30

B = 21

C = 71

(A > B and A > C) or B < C

a)

True

b)

False

5.

c=35 if 34<43 else 43

a)

34

b)

43

c)

35

d)

1

6.

If you add new items to a list, the new items will be placed at the end of the list.

a)

True

b)

False

7.

Output of this code?

a)

[2,4,6,8,10]

b)

['2','4','6','8','10']

c)

[0,2,4,6,8]

d)

[10,8,6,4,2]

8.

The count() method returns the number of times the specified element appears in the list.

What is the output of this code?

a)

3

b)

2

c)

1

d)

0

9.

people = ["John", "Rob", "Bob"]

print (people[-1])

what would this result be?

a)
John
b)
Rob
c)
Bob
10.

#What is the output?

a)

1,2,3,4,5

b)

0,1,2,3,4

c)

1,2,3,4

d)

5,4,3,2,1