String, Integer, or Float? 50
Integer
Which keyword is used to start a decision-making statement in Python?
If
Which loop is best for repeating a block of code a specific number of times?
For loop
A list is written with these symbols.
[]
A dictionary stores data in these two parts.
Key and value
"Hello" is an example of this data type.
String
What word is used to check another condition if the first one is false?
Elif
Which loop runs as long as its condition is True?
While
What is the index of the first item in a Python list?
0
Which symbols are used to create a dictionary?
{}
Floats
In if x > 10: print("Yes"), what happens if x equals 10?
Nothing happens
This keyword stops the loop completely.
Break
What will this print?
fruits = ["apple", "banana", "cherry"]
print(fruits[1])
"banana"
student = {"name": "Alex", "age": 15}
print(student["name"])
"Alex"
What data type is 0.0?
Float
Fill in the blank:
if score > 90:
grade = "A"
_____ score > 80:
grade = "B"
else:
grade = "C"
elif
This keyword skips the rest of the current loop iteration but keeps looping.
Which method adds a new item to the end of a list?
.append()
pet = {"type": "dog"}
pet["name"] = "Buddy"
print(pet)
# Output: {"type": "dog", _____ }
What data type is 4 + 3.0?
Float
True or False: An else statement must always come after an if.
False
What is the output of this code?
for i in range(5):
if i == 3:
break
print(i)
0
1
2
What will this print?
nums = [10, 20, 30, 40]
nums.pop(2)
print(nums)
[10, 20, 40]
scores = {"Alice": 90, "Bob": 85}
scores["Alice"] = 95
print(scores)
{"Alice": 95, "Bob": 85}