wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Intro to Python

Total questions: 24

Worksheet time: 12mins

Name
Class
Date
1.

Which operator is used for subtraction in Python

a)

_ (underscore)

b)

* (asterisk)

c)

- (hyphen)

d)

\ (backslash)

2.

Which operator is used for multiplication in Python

a)

# (hash mark)

b)

* (asterisk)

c)

x (x character)

d)

** (double asterisk)

3.

Which operator is used for addition in Python

a)

+ (plus)

b)

# (hash mark)

c)

& (ampersand)

d)

* (asterisk)

4.

Which operator is used for integer division in Python

a)

/ (slash)

b)

% (percent)

c)

^ (caret)

d)

// (double slash)

5.

Which operator is used for exponentiation (to the power of) in Python

a)

^ (caret)

b)

\ (backslash)

c)

** (double asterisk)

d)

* (asterisk)

6.

Which operator is used for remainder when dividing in Python

a)

% (percent)

b)

/ (slash)

c)

// (double slash)

d)

& (ampersand)

7.

Which operator is used for regular division (returns a decimal) in Python

a)

% (percent)

b)

/ (slash)

c)

// (double slash)

d)

\ (backslash)

8.

Which Python function is used to turn any number positive?

a)

round()

b)

abs()

c)

max()

d)

min()

9.

Which Python command would be used to find the square root of 81?

a)

squareroot(81)

b)

sqrt(81)

c)

math.squareroot(81)

d)

math.sqrt(81)

10.

Which is the correct Python command to round the answer of 17 divided by 3 to 2 decimal places?

a)

round(17 // 3, 2)

b)

round(17, 3, 2)

c)

round(17 / 3)

d)

round(17 / 3, 2)

11.

Which of the following is the correct way to write the following math expression:
 526+9\frac{5-2}{6+9}  

a)

5 - 2 / (6 + 9)

b)

(5 - 2) / (6 + 9)

c)

(5 - 2) / 6 + 9

d)

5 - 2 / 6 + 9

12.

Which of the following is the correct way to write the following math expression:
 7(62)7\left(6-2\right)  

a)

7 6 - 2

b)

7 * 6 - 2

c)

7 * (6 - 2)

d)

7 (6 - 2)

13.

Matthew has a 57 inch string. He wants to know how much he will have left if he cuts the string into as many 14 inch lengths as possible. Which Python expression can be used to figure this out?

a)

57 / 14

b)

57 \ 14

c)

57 % 14

d)

57 // 14

14.

Which of the following Python commands is valid?

a)

print(ABC)

b)

Print("ABC")

c)

print("ABC)

d)

print("ABC")

15.

What will the following Python command output?

print("ABC", 123)

a)

ABC123

b)

ABC 123

c)

"ABC", 123

d)

an error

16.

Which file extension is used when saving Python scripts?

a)

.py

b)

.pyc

c)

.png

d)

.python

17.

Which IDLE mode is used for writing a Python program that can be saved and run later?

a)

file mode

b)

script mode

c)

interactive mode

d)

beast mode

18.

Which IDLE mode is used for running Python commands immediately when the enter key is pressed?

a)

test mode

b)

script mode

c)

interactive mode

d)

beast mode

19.

Python is case sensitive. What does this mean?

a)

Python commands can use either lowercase or uppercase letters.

b)

Python will give a warning when you use the wrong letter case, but will still run the command.

c)

Python commands must be typed exactly as expected, including using whether letters are capitalized or not.

d)

Python breaks down and cries when you talk about it's case.

20.

Which of the following is invalid Python?

a)

print("ABC")

b)

print("123")

c)

print(ABC)

d)

print(123)

21.

What will be the output of the following print command?

print("4 + 5 + 6")

a)

15

b)

4 + 5 + 6

c)

4 + 5 + 6 = 15

d)

there will be an error

22.

Which of the following can be used to print a blank line to the screen.

a)

print()

b)

print("")

c)

Add \n to the end of a print string

d)

All of the Above

23.

What will the following print statement output?

print("lol" * 3)

a)

lollollol

b)

lololol

c)

lol lol lol

d)

there will be an error

24.

Which command must you use to be able to use functions in the math module?

a)

use math

b)

import(math)

c)

import math

d)

None of the Above