Font size
WorksheetsPython 101 Grade 8
Total questions: 15
Worksheet time: 8mins
The followings are valid ways to comment on a code in Python?
#hello
'''world
is good'''
True
False
Which of the following is a valid function?
run
forward
forward()
forward;
Which one of the following moves the actor three times?
move()
move()
move()
move() *3
forward()
forward()
forward()
forward() {3}
In Python, a variable or identifier starts with only a letter or an underscore. Which of the following is a valid variable or identifier? Select all that apply.
2_count
3_COUNT_NUMBER
_identifier
#count
Which one of the following is a valid example of commenting in Python?
#Here we have some code
Here we have some code
_here_there_is_a_code
_3code
Which of the following is a valid example of a "snake case" in Python?
_my_variable_
myVariable
_mycode#
my_code
An identifier starts with an underscore "_".
True
False
Commented lines affect the execution of the program.
True
False
'''Hello
World''' is the correct way to comment multiple lines in Python.
True
False
The following code will print "Hello" 12 times.
for i in range(3):
for j in range(4):
print('Hello')
True
False
How many times the following "for-loop" will be executed?
for i in range(12,8,-1):
3
4
5
6
Which one of the following is the incorrect for-loop?
for 4 in range():
for i in range(6):
for i in range(1,5):
for i in range(8,3,-1):
Which of the following is the correct way to run all numbers from 0 to 8?
for i in range(8):
for i in range(1,8):
for i in range(9):
for i in range(-8):
For-loops can increment upward and downward, such as:
for i in range(1,10,2): and for i in range(10,1,-2):
True
False
for i in range(25):
for j in range(4):
forward()
How many times the "forward()" function will run?
29
100
21
25
