wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Basics Unit 3.1

Total questions: 24

Worksheet time: 17mins

Name
Class
Date
1.

What is an assignment operator in python?

a)

+

b)

( )

c)

=

d)

==

2.

How do you comment in Python?

a)
#
b)

*

c)
''' '''
d)

( )

3.

What is the data type return for this code: print(type(6.8))

a)

<class 'int'>

b)

<class 'str'>

c)

<class 'float'>

d)

<class 'bool'>

4.

What is the data type return for this code: print(type("hello"))

a)

<class 'int'>

b)

<class 'str'>

c)

<class 'float'>

d)

<class 'bool'>

5.

What is the data type return for this code: print(type(6))

a)

<class 'int'>

b)

<class 'str'>

c)

<class 'float'>

d)

<class 'bool'>

6.

What is the data type return for this code: print(type(True))

a)

<class 'int'>

b)

<class 'str'>

c)

<class 'float'>

d)

<class 'bool'>

7.

What is the data type return for this code: print(type("5"))

a)

<class 'int'>

b)

<class 'str'>

c)

<class 'float'>

d)

<class 'bool'>

8.

What is the data type return for this code: print(type(-10))

a)

<class 'int'>

b)

<class 'str'>

c)

<class 'float'>

d)

<class 'bool'>

9.

What is the data type return for this code: print(type(3.0))

a)

<class 'int'>

b)

<class 'str'>

c)

<class 'float'>

d)

<class 'bool'>

10.

The value a computer returns after completing a function.

a)

Return Value

b)

Value

c)

Output

d)

Answer

11.

What are the variables in this code:

x = input("What car do you drive?")

y = input("What is your favorite type of pizza?")

a)

X

b)

Y

c)

x

d)

y

12.

What is the best way to fix this error?

line 4, in <module>

    difference = first_age - second_age

TypeError: unsupported

operand type(s) for -: 'str' and 'str'

a)

Change each variable into an integer.

b)

Change each variable into an float.

c)

Change each variable into an boolean.

d)

Change each variable into an type.

13.

Match the following python fuctions

a)

float()

1.

Float-point

b)

str()

2.

String

c)

bool()

3.

Boolean value

d)

int()

4.

integer

e)

type()

5.

data type

14.

Putting a function inside another function or a loop inside another loop. One method is contained within another one.

a)

Cropping

b)

Nesting

c)

Combining

d)

Matching

15.

In this code print(type(input("type in a name: "))) what part executes first?

a)

print(type(input("type in a name: ")))

b)

input("type in a name: ")

c)

(type(input("type in a name: ")))

16.

What is the best way to turn an this input into and integer?

a)

int(input("What is your age?"))

b)

input(int("What is your age?"))

c)

int(print(input("What is your age?")))

17.

What are the only two possible conditions for a boolean data type?

a)

True

b)

False

c)

Yes

d)

No

18.

What are the 3 logical operators you will see in Python that mean the same in the English language?​ ​​ ​ ​

a)
and
b)
or
c)
not
d)
at
e)
if
19.

What do the symbols != mean in Python?

a)

grater than

b)

excitedly equal

c)

equal

d)

not equal

20.

In what order does the computer complete operations in math?

a)

Parenthesis

b)

Exponents

c)

Multiplication

d)

Division

e)

Addition

1)
2)
3)
4)
5)
21.

How are operations performed in the event of a tie between multiplication and division or addition and subtraction?

a)

from left to right

b)

from right to left

c)

from top to bottom

22.

Identify the nested conditional.

23.

Match the following

a)

''' '''

1.

Multiline comments

b)

#

2.

Signal line comments

c)

" "

3.

String

d)

type()

4.

identifies data types in a code.

24.

Which is NOT a data type in python?

a)

string

b)

integer

c)

boolean

d)

float

e)

type