wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Check

Total questions: 11

Worksheet time: 7mins

Name
Class
Date
1.

def mystery(x):

return x * x - x

print(mystery(4))

a)
12
b)
8
c)
16
d)
0
2.

Which of the following is a default built-in function in Python?

a)
size()
b)
len()
c)

sqrt()

d)
total()
3.

for i in range(1, 5):

if i % 2 == 0:

print(i, end=" ")

What would be output?

a)

1 2 3 4

b)

2 4

c)

1
3

d)

0 2 4

4.

(a)   math module function is used to return the smallest integer greater than or equal to a number

5.

x = 5

while x > 0:

x -= 1

if x == 2:

continue

print(x, end=" ")

Identify the output.

a)

4 3 1 0

b)

4 3

c)

4
3

d)

4

3

1

0

6.

The keyword (a)   is used in Python to define a user-defined function.

7.

The for loop uses a built-in function called (a)   to generate a sequence.

8.

The sqrt(16) returns 4.0

a)

True

b)

False

c)

Error

9.

def calc(x, y=3):

return x + y

print(calc(4))

a)
7
b)
5
c)
8
d)
6
10.

num = 10

if num % 3 == 0:

print("Divisible by 3")

elif num % 5 == 0:

print("Divisible by 5")

else:

print("Not divisible")

a)

Not Divisible

b)
Divisible by 4
c)
Divisible by 6
d)
Divisible by 5
11.

Write the missing condition to print numbers from 5 to 1 using a while loop:

i = 5

while ?????:

print(i)

i -= 1

a)
i < 5
b)

i <= 1

c)

i <= 0

d)
i != 1