-
Notifications
You must be signed in to change notification settings - Fork 159
Añadir ejercicio 043-inheritance_and_polymorphism #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Añadir ejercicio 043-inheritance_and_polymorphism #62
Conversation
|
self.specialization = specialization | ||
|
||
def study(self, hours): | ||
print(f"{self.name} is a high school student specializing in {self.specialization} and is studying for {hours} hours for exams.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cambiar print
por return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
2. Agrega un nuevo atributo llamado `major` para representar la carrera que están estudiando. | ||
|
||
3. Modifica el método heredado `introduce` para imprimir este string: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Para imprimir retornar este string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,46 @@ | |||
# `043` inheritance and polymorphism |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hacer los mismos cambios que en español
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,47 @@ | |||
# `043` inheritance and polymorphism |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Poner Inheritance con I mayuscula
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
self.major = major | ||
|
||
def introduce(self): | ||
print(f"Hi there! I'm {self.name}, a college student majoring in {self.major}.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cambiar print por return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
print(f"Hello! I am {self.name}, I am {self.age} years old, and my current grade is {self.grade}.") | ||
|
||
def study(self, hours): | ||
print(f"{self.name} is studying for {hours} hours.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cambiar print por return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
self.grade = grade | ||
|
||
def introduce(self): | ||
print(f"Hello! I am {self.name}, I am {self.age} years old, and my current grade is {self.grade}.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cambiar print por return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
print(f"Hi there! I'm {self.name}, a college student majoring in {self.major}.") | ||
|
||
def attend_lecture(self): | ||
print(f"{self.name} is attending a lecture for {self.major} students.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cambiar print por return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
college_student = CollegeStudent("Alice", 20, 90, "Computer Science") | ||
college_student.introduce() | ||
college_student.study(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agregar print
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
No description provided.