wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2.00

Total questions: 20

Worksheet time: 3mins

Name
Class
Date
1.

print(type([1, 2, 3]))

a)

int

b)

Error

c)

list

2.

What keyword starts a loop that repeats a known number of times?

a)

while

b)

loop

c)

for

3.

What is the index of "🐥" in this list?

["🐢" , "🐥", "🦩"]

a)

0

b)

1

c)

2

4.

What does this code print?

print(5/0)

a)

0

b)

5

c)

5/0

d)

Error

5.

What will this do?

fruit = ["🍎" , "🍌"]

fruit[1] = "🍉"

print(fruit)

a)

["🍎", "🍉"]

b)

["🍎", "🍌", "🍉"]

c)

🍉🍎

6.

What is not True in Python?

a)

False

b)

0

7.

What will this print?

text= "Hello Python"

print(text[2])

a)

e

b)

l

c)

Python

d)

Hello Python

Hello Python

8.

What will we get as a result here?

print(False == False and 5>2)

a)

False

b)

True

9.

What will this code print?

text = "Hello Go My Code"

print(text.count('o'))

a)

o

b)

3

c)

16

10.

What will this code print?

Print("Hello World")

a)

Hello World

b)

Error

11.

What’s the correct way to write a comment in Python?

a)

<!-- comment -->

b)

// comment

c)

# comment

d)

** comment

12.

What’s the correct way to get all keys from this dictionary?

my_dict = {"a": 1 , "b": 2}

a)

my_dict.keys()

b)

keys(my_dict)

c)

print("a" + "b")

13.

What does this output?

drinks = ["🥤", "🍵","🍼"]

print(len(drinks))

a)

2

b)

["🥤", "🍵","🍼"]

c)

3

14.

Which of these creates a tuple?

a)

[1, 2]

b)

{1, 2}

c)

(1, 2)

15.

What will this code print?

print("Hello world 🚀")

a)

Hello world 🚀

b)

Hello World 🚀

c)

Error

d)

Hello world

16.

What is the first key in this dict?

(a)  

17.

What is the value of the second key in this dict?

(a)  

18.

What happens here?

x = 5

x += 2

print(x)

a)

5

b)

52

c)

7

19.

What is the name of this data structure?

data = {1, 2, 2, 23, 8, 2}

(a)  

20.

So, what is the output of this?

data = {1, 2, 2, 23, 8, 2}

a)

{1, 2, 2, 23, 8, 2}

b)

{1, 2, 23, 8}

c)

{8, 1, 2, 23}