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 7cde506 commit 37db929Copy full SHA for 37db929
2_intermediate/chapter12/solutions/student_class
@@ -0,0 +1,18 @@
1
+# Create a class called Student with instance attributes: Name and Age.
2
+# The user can input the Name and Age. Add 2 methods to the class:
3
+# A raiseHand method which prints out the student name followed
4
+# by “is now raising their hand.” A growOlder method that makes the
5
+# student older by 1 year.
6
+
7
+class Student:
8
9
+ def __init__(self, name, age):
10
+ self.name = name
11
+ self.age = age
12
13
+ def raiseHand(self):
14
+ print(self.name + " is now raising their hand.")
15
16
+ def growOlder(self):
17
+ self.age += 1
18
0 commit comments