Skip to content

Commit

Permalink
new version
Browse files Browse the repository at this point in the history
  • Loading branch information
nachokhan committed Jan 22, 2024
1 parent 7bfd008 commit c291a4d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
3 changes: 3 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@

mayra = Person("Mayra", 20)
mayra_pet = Pet("Cuchuflo", 4)

juancito.print_person_data()
mayra.print_person_data()
12 changes: 6 additions & 6 deletions moduleA/person.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
from moduleB.pet import Pet


class Person():
def __init__(self, name, age) -> None:
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
self.pet = None

def print_person_data(self):
print(f"This person is called {self.name} and it's {self.age} years old.")
print(f"This person is called {self.name} and is {self.age} years old.")
if self.pet:
print(f"This person has a pet!: {self.pet.print_pet_info()}")

def change_age(self, new_age):
self.age = new_age

def change_name(self, newName):
self.name = newName
def change_name(self, new_name):
self.name = new_name

def set_Pet(self, pet: Pet):
def set_pet(self, pet: Pet):
self.pet = pet
18 changes: 9 additions & 9 deletions moduleB/pet.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class Pet():
class Pet:

def __init__(self, petName: str, perAge: str) -> None:
self.name = petName
self.age = perAge
def __init__(self, pet_name: str, pet_age: int):
self.name = pet_name
self.age = pet_age

def print_pet_info(self):
# TODO
print(f"This pet's name is {self.name} and it is {self.age} years old.")

def change_pet_age(self, newAge):
# TODO
def change_pet_age(self, new_age):
self.age = new_age

def change_pet_name(self, newName):
# TODO
def change_pet_name(self, new_name):
self.name = new_name

0 comments on commit c291a4d

Please sign in to comment.