+ 3

Why not color of g.color and Dog.color shud be blue?? Why error is showing in print( g.color) and print (Dog.color)

class Dog: legs = 4 color= blue def __init__(self, name, color): self.name = name g = Dog("Fido", "brown") print(g.legs) print(Dog.legs) Dog.legs = 6 print (g.legs ) print (Dog.legs) print (g.color) print(Dog.color)

28th May 2018, 3:24 PM
Suprabhat kumar
Suprabhat kumar - avatar
2 Answers
+ 3
dude i thought same but there is error can u fix that error
28th May 2018, 3:32 PM
Suprabhat kumar
Suprabhat kumar - avatar
+ 3
thanx budddy
28th May 2018, 3:34 PM
Suprabhat kumar
Suprabhat kumar - avatar