Complete the code to define a constructor method in a Python class.
class Car: def [1](self): self.color = 'red'
The constructor method in Python is named __init__. It runs when a new object is created.
Complete the constructor to accept a parameter and assign it to an instance variable.
class Person: def __init__(self, name): self.[1] = name
The instance variable should match the parameter name to store the value properly.
Fix the error in the constructor method name.
class Animal: def [1](self): self.type = 'mammal'
The constructor must be named exactly __init__ with double underscores on both sides.
Fill both blanks to create a constructor that sets two instance variables.
class Book: def __init__(self, title, author): self.[1] = title self.[2] = author
The instance variables should match the parameter names to store the values correctly.
Fill all three blanks to create a constructor that initializes three instance variables.
class Laptop: def __init__(self, brand, model, price): self.[1] = brand self.[2] = model self.[3] = price
The instance variables should match the constructor parameters to store the values properly.