Methods | SoloLearn: Learn to code for FREE!



fido = Dog("Fido", "brown") print(fido.color) fido.bark() Can we say Fido.color ()=Brown? What does the () represent please?

3/8/2018 4:24:54 AM


3 Answers

New Answer


"Can we say Fido.color ()=Brown?" Answer : No, we cannot say that. If you wanted to change the color attribute of fido, you use fido.color = "brown" without the parantheses "What does the () represent please?" The parentheses i.e () is characteristic of methods so doing something like fido.color() implies that you are calling a method color() inside class Dog.


Also, is Fido.Color = Print (Fido.Color)


Since you didn't include whole code, i can only make assumption. I think 'color' may be a variable (if not property ofcourse). And bark is a method, so you must include parenthesis () inorder to call it. A variable doesn't need ().