WorksheetsPython Quiz 1 : Python Basics
Total questions: 10
Worksheet time: 5mins
Which function outputs text to the terminal?
write()
print()
output()
type()
What is Python syntax for creating a variable and assigning the number 10 to it?
def variable_name = 10
variable_name == 10
variable_name = 10
new variable_name = 10
How do you combine two strings?
string1.concatenate(string2)
string1.combine(string2)
string1 + string2
What is the value of total_cost that gets printed?
total_cost = 5
total_cost += 10
print(total_cost)
15
5
10
What is the output of the following code?
cool_number = 12 + 30
cool_number * 5
print(cool_number)
210
42
cool_number
What happens when running the following code?
message = What a cool message!
print(message)
"message" is printed
"What a cool message!" is printed
Python throws a SyntaxError
Which of the following will produce a SyntaxError?
answer = "Is this an error"
answer = "Is this an error'
answer = is_this_an_error
Which of the following defined variables is a string?
cool_variable_1 = 23.18
cool_variable_2 = 9
cool_variable_3 = "Important Message!"
cool_variable_4 = 14 ** 3
cool_variable1
cool_variable2
cool_variable3
cool_variable4
What is the difference between a float and an int?
A float is a whole number. An int has a decimal point
A float represents decimal numbers. An int is a whole number
A float contains text. An int is any number
Which character is used to specify a comment in Python?
"
*
/
#
