Skip to content

Commit 7cde506

Browse files
authored
Add teacher
1 parent 7ea6247 commit 7cde506

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Create a class called Teacher. Add 3 variables to this
2+
# class: Name, Age, and an array of Student classes from student_class.
3+
# The user can input these 3 variables. Add 2 Methods to the class: A
4+
# displayClass method that prints out the names of all the students.
5+
# A graduate method that increments the age of all of his/her students by 1.
6+
# Then prints out all the ages.
7+
8+
# Student class implemented below. Teacher class uses it.
9+
10+
class Student
11+
12+
def __init__(self, name, age):
13+
self.name = name
14+
self.age = age
15+
16+
def raiseHand(self):
17+
print(self.name + " is now raising their hand.")
18+
19+
def growOlder(self):
20+
self.age += 1
21+

0 commit comments

Comments
 (0)