diff --git a/__pycache__/classes.cpython-313.pyc b/__pycache__/classes.cpython-313.pyc new file mode 100644 index 0000000..c5f358a Binary files /dev/null and b/__pycache__/classes.cpython-313.pyc differ diff --git a/classes.py b/classes.py new file mode 100644 index 0000000..6ef2e1b --- /dev/null +++ b/classes.py @@ -0,0 +1,21 @@ +class Panda: + + def __init__(self, name:str,country:str, age:int, is_hungry:bool): + self.name=name + self.country=country + self.age=age + self.is_hungry=is_hungry + + def sleep (self): + message= f"The {self.name} is sleeping now" + return message + + def hungry(self): + if self.is_hungry: + message_hungry=f"{self.name} is hungry !!" + else: + message_hungry=f"{self.name} is not hungry :)" + return message_hungry + + + diff --git a/main.py b/main.py new file mode 100644 index 0000000..ce1f07a --- /dev/null +++ b/main.py @@ -0,0 +1,19 @@ +from classes import Panda + +panda1= Panda("Bao Bao","China",2,False) +panda2= Panda("Ling Ling","Japan",10,True) +panda3= Panda("Le Le","France",17,False) +panda4= Panda("Jia Jia","Australia",22,True) + +print(panda1.name) +print(panda1.hungry()) +print(panda1.sleep()) + +print(panda2.hungry()) +print(panda2.sleep()) + +print(panda3.hungry()) +print(panda3.sleep()) + +print(panda4.hungry()) +print(panda4.sleep()) \ No newline at end of file