182k views
1 vote
__init__(self, features, phones): create/initialize instance variables for features and the list of phones (optional) in the plan. When phones is not provided, use an empty list as its initial value. Create an instance variable

1 Answer

5 votes

Answer:

class Phone(object):

def __init__(self, features, phones=[]):

self.features = features

self.phones = phones

Step-by-step explanation:

In python object-oriented programming, an instance variable of a class object is created in the "__init__()" method. the "self" is a convention name used to represent the instance of an object class. The input values are assigned to the object variable with the self.'argument_name' statement.

When the phone argument is not given, the self.phones variable is initialized as an empty list.

User Rmannn
by
5.2k points