We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ea6247 commit 7cde506Copy full SHA for 7cde506
2_intermediate/chapter12/practice/teacher_class.py
@@ -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