Complete the code to define a constructor that takes one parameter 'name'.
class Person: def __init__(self, [1]): self.name = name
The constructor method __init__ takes 'name' as a parameter to initialize the object.
Complete the code to assign the parameter 'age' to the instance variable.
class Person: def __init__(self, age): self.age = [1]
self.age to itself instead of the parameter.We assign the parameter 'age' to the instance variable self.age to store it in the object.
Fix the error in the constructor parameter to correctly accept two parameters: 'name' and 'age'.
class Person: def __init__(self, [1]): self.name = name self.age = age
Parameters must be separated by commas. The constructor always has 'self' as the first parameter, which is already there.
Fill both blanks to create a constructor that assigns 'name' and 'age' parameters to instance variables.
class Person: def __init__(self, name, age): self.name = [1] self.age = [2]
The constructor assigns the parameters 'name' and 'age' to the instance variables self.name and self.age.
Fill all three blanks to create a constructor that assigns 'name', 'age', and 'city' parameters to instance variables.
class Person: def __init__(self, name, age, city): self.name = [1] self.age = [2] self.city = [3]
The constructor assigns each parameter to its matching instance variable using self..