Python - 9 - Classes and Object-Oriented Programming Exercises

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

what book or material is this from? btw your volume is too low to hear anything

satoshinakamoto
Автор

Thanks, it really helped understand how a class works, I was really confused about it

Dante-nucn
Автор

This one better . class Pet:
def __init__(self, name, animaType, age):
self.name = name
self.animalType = animaType
self.age = age


def setName(self, ):
self.name = input('Enter a name')

def setAnimaType(self):
self.animalType = input('Enter a Animal type')

def setAge(self):
self.age = input('Enter a age')

def getName(self):
return self.name

def getAnimalType(self):
return self.animalType

def getAge(self):
return self.Age

def __str__(self):
return f'Name: {self.name} Animal type {self.animalType} age {self.age}'



pet1 = Pet('Haris', 'Cat', 4)

#print(pet1)

pet1.setName()
pet1.setAnimaType()
pet1.setAge()

print(pet1)

rytis
Автор

fuck very bad audio i have connected to home theatre still low

rahulastic
Автор

Dude, I need this book.Can you share with me?

mertolgun