culTest

    One of the 50 questions in this topic

    How much do you know about Python?

    What is an instance variable in Python?

    Answers

    A variable defined within a method
    A variable that belongs to a specific instance of a classCorrect
    A variable that can only contain instances of classes
    A temporary variable that is removed after use

    An instance variable belongs to a specific instance of a class, storing data unique to each object. They are typically defined in the __init__ method using self.variable_name. Unlike class variables (defined at the class level and shared between all instances), each instance has its own independent copy of the instance variables, allowing each object to maintain its own state.