I'm having problem creating objects of classes. An object of class has the attributes(i.e fields, methods) of it's class. Can we also define attributes for an object outside the class???
class myclass:
pass
object1 = myclass()
object2 = myclass()
object1.list = [10]
object1.list.append(4)
object2.fruit = 'apple'
print object2.fruit
print object1.list
OUTPUT:
apple
[10, 4]
Please explain how it is working.