Classes 101 - Solution
June 25, 2022 ยท View on GitHub
Objectives
- Define a class that does nothing and name it
SomeClass - Create an instance of the class you defined and assign it to the variable
c - True or False? In case of
c.x = 1,xis a variable of value 1 - How to retrieve the value of
xattribute from the previous question?
Solution
class SomeClass:
pass
c = SomeClass()
- False. in
c.x,xis an attribute of the instancecand not a variable c.x