Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 508 Bytes

File metadata and controls

26 lines (18 loc) · 508 Bytes

Classes 101 - Solution

Objectives

  1. Define a class that does nothing and name it SomeClass
  2. Create an instance of the class you defined and assign it to the variable c
  3. True or False? In case of c.x = 1, x is a variable of value 1
  4. How to retrieve the value of x attribute from the previous question?

Solution

class SomeClass:
    pass
c = SomeClass()
  1. False. in c.x, x is an attribute of the instance c and not a variable
  2. c.x