Font size
WorksheetsPython Basics Unit 3.1
Total questions: 24
Worksheet time: 17mins
What is an assignment operator in python?
+
( )
=
==
How do you comment in Python?
*
( )
What is the data type return for this code: print(type(6.8))
<class 'int'>
<class 'str'>
<class 'float'>
<class 'bool'>
What is the data type return for this code: print(type("hello"))
<class 'int'>
<class 'str'>
<class 'float'>
<class 'bool'>
What is the data type return for this code: print(type(6))
<class 'int'>
<class 'str'>
<class 'float'>
<class 'bool'>
What is the data type return for this code: print(type(True))
<class 'int'>
<class 'str'>
<class 'float'>
<class 'bool'>
What is the data type return for this code: print(type("5"))
<class 'int'>
<class 'str'>
<class 'float'>
<class 'bool'>
What is the data type return for this code: print(type(-10))
<class 'int'>
<class 'str'>
<class 'float'>
<class 'bool'>
What is the data type return for this code: print(type(3.0))
<class 'int'>
<class 'str'>
<class 'float'>
<class 'bool'>
The value a computer returns after completing a function.
Return Value
Value
Output
Answer
What are the variables in this code:
x = input("What car do you drive?")
y = input("What is your favorite type of pizza?")
X
Y
x
y
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'
Change each variable into an integer.
Change each variable into an float.
Change each variable into an boolean.
Change each variable into an type.
Match the following python fuctions
float()
Float-point
str()
String
bool()
Boolean value
int()
integer
type()
data type
Putting a function inside another function or a loop inside another loop. One method is contained within another one.
Cropping
Nesting
Combining
Matching
In this code print(type(input("type in a name: "))) what part executes first?
print(type(input("type in a name: ")))
input("type in a name: ")
(type(input("type in a name: ")))
What is the best way to turn an this input into and integer?
int(input("What is your age?"))
input(int("What is your age?"))
int(print(input("What is your age?")))
What are the only two possible conditions for a boolean data type?
True
False
Yes
No
What are the 3 logical operators you will see in Python that mean the same in the English language?
What do the symbols != mean in Python?
grater than
excitedly equal
equal
not equal
In what order does the computer complete operations in math?
Parenthesis
Exponents
Multiplication
Division
Addition
How are operations performed in the event of a tie between multiplication and division or addition and subtraction?
from left to right
from right to left
from top to bottom
Identify the nested conditional.
Match the following
''' '''
Multiline comments
#
Signal line comments
" "
String
type()
identifies data types in a code.
Which is NOT a data type in python?
string
integer
boolean
float
type
