Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a776bdb

Browse files
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+
returnf"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+
returnf"{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+
returnf"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+
returnf"{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)

AltStyle によって変換されたページ (->オリジナル) /