What method converts all letters in a string to uppercase?
upper()
What symbol is used to create a list?
Square brackets [ ]
Which loop is used when the number of repetitions is known?
for loop
What does range(5) start with?
0
What symbol is used inside an f-string to insert variables?
{ }
What is the output of:
print("Python"[0])
P
Which method adds an item at the end of a list?
append()
Which loop runs while a condition is true?
while loop
What numbers does range(1, 4) produce?
1, 2, 3
Which statement correctly uses an f-string?
A. print("Age: {age}")
B. print(f"Age: {age}")
B
What does len("computer") return?
8
What is the output of:
nums = [1, 2, 3]
print(nums[-1])
3
What keyword stops a loop immediately?
break
What is the output of:
for x in range(2, 8, 2):
print(x)
2
4
6
What is the output of:
name = "Sam"
score = 90
print(f"{name} scored {score}")
Sam scored 90
What is the output of:
print("Hi" * 2)
HiHi
Which method inserts an item at a specific position?
insert()
What is the output of:
for i in range(3):
print(i)
0
1
2
What is a loop counter?
A variable that controls or counts loop repetitions
What is the length of this list?
items = ["a", "b", "c", "d"]
4
What is the output of:
word = "banana"
print(word.replace("a", "o"))
bonono
What happens if you use remove() on a value not inside the list?
An error occurs
What is the output of:
count = 2
while count >= 0:
print(count)
count -= 1
2
1
0
How many times will this loop run?
for i in range(1, 10, 3):
print(i)
3 times (1, 4, 7)
What is the output of:
text = "HELLO"
print(text.lower())
hello