0

How can we pass a list to create an instance of a class? Please check the code below.

On running it I am getting errors as:

TypeError: __init__() missing 3 required positional arguments: 'age', 'level', and 'salary'
#class definition

class SoftwareEngineer:

    #constructor
    def __init__(self, name, age, level, salary):
        #instance attributes
        self.name = name
        self.age = age
        self.level = level
        self.salary =salary

#instance of the class
ls = ["Mark", 24, "SSE", 6000]
SE_1 = SoftwareEngineer(ls)

martineau
  • 112,593
  • 23
  • 157
  • 280

0 Answers0