Skip to content

Commit a776bdb

Browse files
authored
Update solution.hide.py
1 parent 2a5eab1 commit a776bdb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

exercises/043-inheritance_and_polymorphism/solution.hide.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ def __init__(self, name, age, grade):
77
self.grade = grade
88

99
def introduce(self):
10-
print(f"Hello! I am {self.name}, I am {self.age} years old, and my current grade is {self.grade}.")
10+
return f"Hello! I am {self.name}, I am {self.age} years old, and my current grade is {self.grade}."
1111

1212
def study(self, hours):
13-
print(f"{self.name} is studying for {hours} hours.")
13+
return f"{self.name} is studying for {hours} hours."
1414

1515
### DON'T modify the code above ###
1616

@@ -22,13 +22,13 @@ def __init__(self, name, age, grade, major):
2222
self.major = major
2323

2424
def introduce(self):
25-
print(f"Hi there! I'm {self.name}, a college student majoring in {self.major}.")
25+
return f"Hi there! I'm {self.name}, a college student majoring in {self.major}."
2626

2727
def attend_lecture(self):
28-
print(f"{self.name} is attending a lecture for {self.major} students.")
28+
return f"{self.name} is attending a lecture for {self.major} students."
2929

3030

3131
college_student = CollegeStudent("Alice", 20, 90, "Computer Science")
32-
college_student.introduce()
33-
college_student.study(3)
34-
college_student.attend_lecture()
32+
print(college_student.introduce())
33+
print(college_student.study(3))
34+
print(college_student.attend_lecture())

0 commit comments

Comments
 (0)