Quiz Catalog

Catalog of quizzes

class Person:
  def __init__(hey, name, age):
  hey.name = name
  hey.age = age

  def my_age(abs):
  print("Hello my name is " + abs.age)

p1 = Person("John", 36)

del p1.age

p1.my_age()
AttributeError: 'Person' object has no attribute 'age'
  • statement/del
  • class/property

class A:
  def __init__(self):
    self.a = 0

  def change(self, n):
    a = n
    
obj = A()
obj.change(2)
print(obj.a)
0
  • class/property