-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPet Class.py
32 lines (28 loc) · 954 Bytes
/
Pet Class.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
"""Python 102 - Assignment 9
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/1LHn1CkiVHSe1fw6RHOl9lCQZjkWmuYxQ
"""
class Pet:
def __init__(self, name, age, animal_type):
self.__name = name
self.__age = age
self.__animal_type = animal_type
def set_name(self, name):
self.__name = name
def set_age(self, age):
self.__age = age
def set_animal_type(self, animal_type):
self.__animal_type = animal_type
def get_name(self, name):
return self.__name
def get_age(self, age):
return self.__age
def get_animal_type(self, animal_type):
return self.__animal_type
def __repr__(self):
return f"(name: {self.__name}) (age: {self.__age}) (animal_type: {self.__animal_type})"
def __str__(self) -> str:
return "Name: " + self.__name + "\nAge: " + self.__age + "\nAnimal Type: " + self.__animal_type
Pet('Victor', '9', 'Dog')