WorksheetsPython Basics 3
Total questions: 25
Worksheet time: 13mins
To display something on the screen, use this command:
print()
Print()
screen()
write()
display()
To display the following on screen
Hello World!
the following command should be used:
print(Hello World!)
print("Hello World!")
print("Hello World" + !)
print"(Hello World!)"
@
#
*
&
Which operator performs a division?
-
+
/
*
Which operator checks if a value is equal to another value?
+
=
==
!=
Which operator checks if a value is not equal to another value?
==
+=
!=
=
The character that must be at the end of the line for if, while, or for statements, and etc.
:
;
.
,
new_var = 1234
new_var = True
new_var = 1.234
new_var = "True"
new_var = "True"
new_var = "3123"
new_var = "3.123"
new_var = False
When you have an error in your code what is the term to summarize finding and fixing that error?
Error checking
Debugging
Syntax finder
Error finder
Which of the following is correct?
Comments are for programmers to better understand the program.
Python Interpreter ignores comments.
You can write multi-line comments in Python using triple quotes, either ''' or """.
All of the above
What is used to take input from the user in Python?
cin
scanf()
input()
<>
When would a while loop be a better control structure to use than a for loop?
when the repeat is based upon the user's input
when you do not know how many times something will need to repeat
when you need to repeat something 10 times
when you need to repeat multiple commands
Which of the following for loops will give the same values for i as the loop below?
for i in range(10):
for i in range(11, 0):
for i in range(0, 10):
for i in range(10, 0, -1):
for i in range(0, 12, 1):
Which of the following for loops would print the following numbers?
0
1
2
3
4
for i in range(4):
print(i)
for i in range(1,4,1):
print(i)
for i in range(5):
print(i)
for i in range(0,4,1):
print(i)
Three of the for loops below will provide identical values for i. Which for loop has a value that will not match the others?
for i in range(0,10):
for i in range(10):
for i in range(10,0,1):
for i in range(0,10,1):
Which of the following while loops would continue to loop as long as num has values between the range of 5-15, exclusive?
while num>15 and num<5:
while num<15 or num<5:
while num<=15 and num>=5:
while num<15 and num>5:
