-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
18 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,6 @@ | |
|
||
mayra = Person("Mayra", 20) | ||
mayra_pet = Pet("Cuchuflo", 4) | ||
|
||
juancito.print_person_data() | ||
mayra.print_person_data() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |