wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

T02: Python - The Basics

Total questions: 10

Worksheet time: 2mins

Name
Class
Date
1.

What is the result of 1 // 2 ?

a)

0

b)

0.5

c)

1.0

d)

1

2.

What is the result of 7 % 5 ?

a)

2

b)

1

c)

1.4

d)

3

3.

Which operator has the highest precedence in Python?

a)

Multiplication

b)

Addition

c)

Exponentiation

d)

Division

4.

Which one uses f-strings correctly?

a)

print("Your age is {}".format(age))

b)

print(f"Your age is {age}")

c)

print("Your age is %d" % age)

d)

print("Your age is " + str(age))

5.

Which of the following is NOT part of the Zen of Python?

a)

Simple is better than complex

b)

Readability counts

c)

Flat is better than nested

d)

Optimisation is king

6.

What is the result of 2 + 3 * 2 ** 2 ?

a)

100

b)

14

c)

64

d)

38

7.

Which of these are NOT valid in Python?

a)

class

b)

my variable

c)

abc

d)

import_from

e)

5days

8.

In Python, how can you get input from the user?

a)

user_input = input()

b)

user_input = read()

c)

user_input = scanf()

d)

user_input = enter()

9.

The first reported computer bug was actually?

a)

A ladybug

b)

A moth

c)

A spider

d)

A beetle

10.

What is the result of type( 7.0 / 2 )

a)

int

b)

float

c)

str

d)

ValueError