Quiz: Python Arrays and Functions

Practice arrays (lists) and functions in Python. This interactive quiz covers list operations, function syntax, arguments, return values, and more.

1.

What is used in Python as an alternative to traditional arrays?

2.

Which method would you use to add an item to the end of a list?

3.

What will the following code output?

python
1
2
car_brands = ["Tesla", "Ford", "BMW"]
print(car_brands[1])
4.

What does the following function do?

python
1
2
def greet(name="Guest"):
    print(f"Hello, {name}!")
5.

How can you pass a variable number of arguments to a function?