NEW
Font size
WorksheetsPython Codehs
Total questions: 10
Worksheet time: 5mins
Which Python code segment will display “Hello, world!” on the screen?
"Hello, world!"
print "Hello, world!"
print("Hello, world!")
display Hello, world!
What does the following Python code display?
print("Hello")
print("World")
HelloWorld
Hello
World
Hello World
"Hello"
"World"
What type is the following variable?
x = "Hi there"
boolean
integer
float
string
What does the following Python program print?
x = "I am"
y = 6
z = "feet tall"
print(x)
print(y)
print(z)
I am6feet tall
I am 6 feet tall
I am
6
feet tall
x
y
z
What is the type of the variable x in the following Python program?
x = input("Enter a number from 1-10: ")
integer
float
string
The type cannot be determined
What does the following Python program print?
x = 9 + 6 / 3 * 2 - 1
print(x)
12
9
14
20
Which of the following operators is used for exponentiation (exponents) in Python?
^
(( ))
**
%
What does the following Python program print?
x = 12 % 4
print(x)
3
0
3R0
36
Which of the following Python programs will NOT run?
x = 4
print(x + 5)
x = 4
y = 5
print(x + y)
x = 4
y = 5.5
print(x + y)
x = 4
y = "hi"
print(x + y)
Which of the following best describes the main purpose of comments?
Comments warn the people running the program about potential problems with the program.
Comments create better spacing in programs.
Comments describe your program so other people can read it more easily.
Comments allow you to test just the portion of the code written in a comment before testing the whole program.
