@@ -7,10 +7,10 @@ def __init__(self, name, age, grade):
7
7
self .grade = grade
8
8
9
9
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 } ."
11
11
12
12
def study (self , hours ):
13
- print ( f"{ self .name } is studying for { hours } hours." )
13
+ return f"{ self .name } is studying for { hours } hours."
14
14
15
15
### DON'T modify the code above ###
16
16
@@ -22,13 +22,13 @@ def __init__(self, name, age, grade, major):
22
22
self .major = major
23
23
24
24
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 } ."
26
26
27
27
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."
29
29
30
30
31
31
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