Skip to content

Commit 6ae4cc8

Browse files
committed
Update instructions and fix style
1 parent 01c281f commit 6ae4cc8

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
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.
1+
# Create a class called Teacher. Add 3 instance variables to this
2+
# class: name, age, and students (a list of Student objects).
3+
# Add 2 Methods to the class: A display_students method that
4+
# prints out the names of all the students, each on their own line, and
5+
# a graduate_students method that increments the age of all of the
6+
# teacher's Students by 1. Then it should print out all their ages.
77

88
# Student class implemented below. Teacher class uses it.
99

@@ -13,8 +13,8 @@ def __init__(self, name, age):
1313
self.name = name
1414
self.age = age
1515

16-
def raiseHand(self):
16+
def raise_hand(self):
1717
print(self.name + " is now raising their hand.")
1818

19-
def growOlder(self):
19+
def grow_older(self):
2020
self.age += 1
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
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.
1+
# Create a class called Teacher. Add 3 instance variables to this
2+
# class: name, age, and students (a list of Student objects).
3+
# Add 2 Methods to the class: A display_students method that
4+
# prints out the names of all the students, each on their own line, and
5+
# a graduate_students method that increments the age of all of the
6+
# teacher's Students by 1. Then it should print out all their ages.
77

88
# Student class implemented below. Teacher class uses it.
99

1010

11-
class Student:
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-
22-
2311
class Teacher:
2412
def __init__(self, name, age, students):
2513
self.name = name
2614
self.age = age
2715
self.students = students
2816

29-
def displayClass(self):
17+
def display_students(self):
3018
for student in self.students:
3119
print(student.name)
3220

33-
def graduate(self):
21+
def graduate_students(self):
3422
for student in self.students:
35-
student.age += 1
23+
student.grow_older()
3624
print(student.age)
25+
26+
27+
class Student:
28+
def __init__(self, name, age):
29+
self.name = name
30+
self.age = age
31+
32+
def raise_hand(self):
33+
print(self.name + " is now raising their hand.")
34+
35+
def grow_older(self):
36+
self.age += 1

0 commit comments

Comments
 (0)