wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Introduction to Python Programming

Total questions: 12

Worksheet time: 9mins

Name
Class
Date
1.

The <-- assignment operator in pseudocode is replaced by _____ in python

a)

==

b)

( )

c)

=

d)

<-- The symbol is the same

2.

What is the value of M after the following operation:

x = 2

M = pow (2 , 3)

(a)  

3.

An instruction is written to determine if the value in a is equal to the value in b.

Choose the correct operator to complete the instruction:

if a ______ b:

a)

<--

b)

=

c)

==

4.

Choose the operators to represent "not equal to" in PYTHON

a)

<>

b)

/=

c)

Not=

d)

!=

5.

What is the output of the following:

a=2

b=3

c=4

a=b

b=a

c=b

print(c)

(a)  

6.

Convert the pseudocode statements to python

print "enter name"

read n

Use double quotation and no space

(a)  

7.

Convert the pseudocode statement to python

print "enter a whole number"

read num

Use double quotation and no space

(a)  

8.

What is the result of the following:

x = 10

m = x % 4

print (m)

(a)  

9.

A statement in the program that is not executed and can explain to another programmer what the code is about

(a)  

10.

What is the output of the following instruction

name = "KEVIN LU"

n = len(name)

print (n)

(a)  

11.

What is the output of the following instructions:

y=3

a=4

n1 = a ** y

print(n1)

(a)  

12.

A Microsoft word document is saved with the extension .doc (e.g. My project.doc). What extension is used when saving python programs?

a)

.pyt

b)

.python

c)

.py

d)

.p