Python Programming Easy • 3 Questions

Python Fundamentals & Syntax Mastery Quiz

Test your understanding of Python variables, data structures, list comprehensions, and functions.

Question 1 of 3 1 point
What is the output of the following list comprehension?
x = [i**2 for i in range(5) if i % 2 == 0]
print(x)
Question 2 of 3 1 point
Which Python built-in data type is mutable and does NOT permit duplicate keys?
Question 3 of 3 1 point
In Python, what is the purpose of the `__init__` method in a class definition?
class Developer:
    def __init__(self, name):
        self.name = name