Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/classes.cpython-313.pyc
Binary file not shown.
21 changes: 21 additions & 0 deletions classes.py
Original file line number Diff line number Diff line change
@@ -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



19 changes: 19 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -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())