+ 2

Help me out to locate the error.

Hi every one, i am unable to locate the error in this code. Thanks class parrot: #class attribute spec = "bird" #costructor def __init__(self, color, age): self.color = color self.age = age #objects of the class blu = ("green", 9) tom = (" blue", 12) #accessing the objects through class print("The blu is a{}".format(blu.__class__.spec)) print("The tom is also a{}".format(tom.__class__.spec)) print("The parrot blu is a{}colured with age of {} years" . format(blu.color, blu.age)) print("The parrot tom is a{}colured with age of {} years" . format(tom.color, tom.age))

13th May 2022, 9:58 AM
Najm Aarifeen
4 Answers
+ 2
Najm Aarifeen blu = ("green", 9) tom = (" blue", 12) are just tuples.. Not objects.. Create objects like : blu = parrot("green", 9) tom = parrot(" blue", 12) Hope it helps..
13th May 2022, 10:05 AM
Jayakrishna šŸ‡®šŸ‡³
+ 2
Thanks dear friend, i wasted much of my time just to locate .
13th May 2022, 10:08 AM
Najm Aarifeen
+ 1
In python, identation is much important. So save code in playground and share link here.. Otherwise it's difficult to find error. And it's not understandable identation errors if any are by typos or unintentional.. Hope you understand..
13th May 2022, 10:02 AM
Jayakrishna šŸ‡®šŸ‡³
+ 1
You're welcome...
13th May 2022, 10:12 AM
Jayakrishna šŸ‡®šŸ‡³