Question: How many instance variables will exist after you run the following code? class Person (): def __init__ ( self , weight = 160 ) :
How many instance variables will exist after you run the following code?
class Person(): def __init__(self, weight = 160): self.weight = weight next_person = Person(150) next_person.foot_size = 10 next_person.eyes = "green"
In Python you can derive a class from two parent classes but not from three parent classes. true or false
What is needed to crea te a new object in Python?
a.define__str__() method
b.define a constructor method
c.both constructor and __str__() methods
d.None of the above.
o define "-" operator for a new class, one needs to:
a.define __sub__() method
b.It is impossible to define such an operator for user-defined classes.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
