0

I'm a python begginer...what I did wrong in this.. Why I don't get any output

Class Do(object): def __init__(self,name,age): self.name= name self.age = age def sit(self): print (self.name.title(),"is sitting") def roll_over(self): print(self.name.title(),"is rolling overcome there") My_dog = Dog("Suji",12) My_dog.name

6th Apr 2020, 3:54 AM
SelvaKumar
3 odpowiedzi
+ 4
Use print(My_dog.name) print() is used to get console output. Your last two lines of code don't belong to your class block so you shouldn't indent it. Also you forgot a g in dog class name. https://code.sololearn.com/cRJ8J2EfPe7D/?ref=app
6th Apr 2020, 4:16 AM
Kevin ★
+ 3
class Dog: def __init__(self,name,age): self.name= name self.age = age def sit(self): print (self.name.title(),"is sitting") def roll_over(self): print(self.name.title(),"is rolling overcome there") My_dog = Dog("Suji",12) print(My_dog.name)
6th Apr 2020, 4:16 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
Thank you friends 😊
6th Apr 2020, 4:21 AM
SelvaKumar