-
-
Save Vasanth375/ccd05cd7120ff04716f8387db57686a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student(Person): | |
def __init__(self, name, age, major): | |
super().__init__(name, age) | |
self.major = major | |
def greet(self): | |
return super().greet() + " My major is " + self.major + "." | |
s1 = Student("Jane", 25, "Computer Science") | |
print(s1.greet()) # Output: "Hello, my name is Jane and I am 25 years old. My major is Computer Science." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment