1/42
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is the correct file extension for Python files?
.py
What is a correct command line syntax for checking if python is installed on your computer? (And also to check the Python version)
python --version
What is a correct syntax to exit the Python command line interface?
exit()
T/F: Indentation in Python is for readability only.
False
T/F: Statements are executed one by one, in the same order as they are written
True
T/F: Semicolons are optional in Python. You can write multiple statements on one line by separating them with one
True
What is the output of the following code:
print("Python is fun!") print("Really!")
Error
The character used to define a single-line Python comment:
#
The character used to define a multi-line Python comment:
“““
What is the output of the following code:
print("Hello World!", end=" ")
print("I will print on the same line.")Hello World! I will print on the same line.
What is the output of the following code: print(3 * 5)
15
What is the output of the following code: print("I am", 35, "years old.")
I am 35 years old
What is a correct way to declare a Python variable x = 5?
x = 5
What is a correct way to declare Python variable y = “Hello, World!”
y = “Hello, World!”
T/F: You can declare string variables with single or double quotes.
True
T/F: Variable names are not case-sensitive.
False
T/F: This is a legal variable name: 2myvar = "John"
False
T/F: This is a legal variable name my-var = "John"
False
T/F: This is a legal variable name MYVAR = "John"
True
What is the output of the following code:
x, y, z = "Orange", "Banana", "Cherry"
print(x)
print(y)
print(z)Orange
Banana
Cherry
What is the output of the following code:
x = y = z = "Orange"
print(x)
print(y)
print(z)Orange
Orange
Orange
What is the output of the following code:
fruits = ["apple", "banana", "cherry"]
x, y, z = fruits
print(x)
print(y)
print(z)apple
banana
cherry
What is the output of the following code:
x = "Python is awesome"
print(x)Python is awesome
What is the output of the following code:
x = "Python "
y = "is "
z = "awesome"
print(x + y + z)Python is awesome
What is the output of the following code:
x = 5
y = 10
print(x + y)15
What is the output of the following code:
x = 5
y = "John"
print(x + y)Error
What is the output of the following code:
x = 5
y = "John"
print(x, y)5 John
What is the output of the following code:
x = "awesome"
def myfunc():
print("Python is " + x)
myfunc()Python is awesome
What is the output of the following code:
x = "awesome"
def myfunc():
x = "fantastic"
print("Python is " + x)
myfunc()
print("Python is " + x)Python is fantastic
Python is awesome
What is the output of the following code:
def myfunc():
global x
x = "fantastic"
myfunc()
print("Python is " + x)Python is fantastic
What is the output of the following code:
x = "awesome"
def myfunc():
global x
x = "fantastic"
myfunc()
print("Python is " + x)
Python is fantastic
What is the output of the following code:
x = 5
y = "John"
print(type(x))
print(type(y))5
John
Fill in the blanks: _____(_____(myvar))
print, type
Fill in the blanks for a variable named “carname” with assigned value “Volvo”:
_____ = _____
carname, “Volvo”
Text data type:
str
Numeric data types:
int, float, complex
Sequence data types:
list, tuple, range
Mapping data type:
dict
Set data types:
set, frozenset
Boolean data type:
bool
Binary data types:
bytes, bytearray, memoryview
None data type:
none
T/F: You can get the data type of any object by using the type() function:
True