Font size
WorksheetsPython basics 8th grade
Total questions: 25
Worksheet time: 39mins
_____ = 25
print(age)
What should fill the blank to declare a variable age with value 25?
age
int age
int(age)
Age
name = "Python"
print(len(name))
What will this code output?
7
6
Python
5
x = 10
y = 3
print(x _____ y)
What operator should fill the blank to output 13?
+
-
*
/
score = 85
if score _____ 60:
print("Pass")
What should fill the blank?
!=
==
>
<
fruits = ["apple", "banana", "cherry"]
print(fruits[_____])
What index should fill the blank to print "apple"?
3
2
1
0
for i in range(_____):
print(i)
What should fill the blank to print numbers 0, 1, 2?
2
3
4
1
text = "hello"
print(text._____)
What method converts the string to uppercase?
UPPER()
upper()
toUpper()
uppercase()
a = 5
b = 5
print(a _____ b)
What operator checks if a equals b?
=
===
!=
==
What should fill the blank to loop 3 times (0, 1, 2)?
==
<=
>
<
x = True
y = False
print(x _____ y)
What operator returns True if at least one value is True?
and
not
or
xor
What method adds 50 to the end of the list?
add
insert
append
push
What keyword should fill the blank?
else if
elseif
if
elif
word = "Python"
print(word[_____])
What should fill the blank to print "thon"?
2:6
1:5
2:
3:
What should fill the blank to print: 2, 3, 4, 5?
6
5
7
4
What operators should fill the blanks?
>, <
==, ==
>=, <=
>, >
colors = ["red", "blue", "green", ...]
print(colors[_____])
What index prints the last element?
3
-1
2
last
What operator should fill the blank?
//
/
*
%
message = "Hello World"
print(message._____)
What method converts to lowercase?
lowercase()
toLower()
lower()
LOWER()
What should fill the blank to sum all numbers?
=+
+=
==
= total +
What operator should fill the blank?
not
!
NOT
and
What condition should fill the blank to get only numbers divisible by 10?
What condition counts the letter 'g'?
What line should fill the blank to prevent an infinite loop?
What condition finds the maximum value?
What condition separates even and odd numbers?
