Consider the following code segment: class Fruit : _type = "Fruit" def __init__(self, color) : self._color = color What is the name of the class variable?
_type is the correct answer for the above question
Explanation:
The class variable is a variable that is defined in the class and the instance variable is defined in the constructor of the class using the self keyword.
The class variable is used as the static variable, but the instance variable is called by the help of objects only.
The above program holds only one class variable which is "_type" because it is defined in the class.