0
Help with program?
So is there something I could add to this class that will print “name” is a “personality” without having to do the print commands I have at the bottom? https://code.sololearn.com/c6WnsWAGDbIN/?ref=app
1 Resposta
+ 1
Yes!!
You can add a method to the class, let's say introduce
class Dog:
def __init__(...):
...
def introduce(self):
print(self.name, ' is ', self.personality)
and then call it on every object