wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Fun for Young Learners

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the correct way to create a variable in Python?

a)

10 = x

b)

x = 10

c)

let x = 10

d)

x : 10

2.

Which of the following is a valid data type in Python?

a)

boolean

b)

float

c)

string

d)

int

3.

What will the output of print(2 + 3) be?

a)

4

b)

7

c)

5

d)

6

4.

How do you start a for loop in Python?

a)

foreach variable in iterable:

b)

for variable in iterable:

c)

for each variable in iterable:

d)

for (variable in iterable) {

5.

What keyword is used to define a function in Python?

a)

function

b)

define

c)

def

d)

method

6.

How can you get user input in Python?

a)

Use the 'read()' function to get user input.

b)

Use the 'scan()' function to get user input.

c)

Use the 'get()' function to get user input.

d)

Use the 'input()' function to get user input.

7.

What will the output of print('Hello' * 3) be?

a)

HelloHelloHello

b)

Hello 3 times

c)

HelloHello

d)

HelloHello!

8.

Which symbol is used for comments in Python?

a)

;

c)

#

d)

//

9.

What is the purpose of the return statement in a function?

a)

To print output to the console.

b)

To create a loop within a function.

c)

The purpose of the return statement is to exit a function and return a value to the caller.

d)

To define a function's parameters.

10.

How do you read a file in Python?

a)

Read a file by calling 'file.read(filename)' directly.

b)

Use 'with open(filename, 'w') as file: content = file.read()' to read a file in Python.

c)

Use 'with open(filename, 'r') as file: content = file.read()' to read a file in Python.

d)

Use 'open(filename) as file: content = file.read()' to read a file in Python.