class Employee:
   def __init__(self, name, age, position):
      self.name = name
      self.age = age
      self.position = position
   def printInfo(self):
      print(f"""
Name: {self.name}
Age: {self.age}
Works as a {self.position}
         """)
class Student:
   def __init__(self, name, age, grade, favoriteItems):
      self.name = name
      self.age = age
      self.grade = grade
      self.favoriteItems = favoriteItems
   def printInfo(self):
      print(f"""
Name: {self.name}
Age: {self.age}
Studying in {self.grade}th grade
Favorite school subjects: {self.favoriteItems}
         """)
     Â
employee = Employee('Whilliam', 34, 'Teacher')
student = Student('John', 15, 10, ['Math', 'Biology'])
employee.printInfo()
student.printInfo()
Comments
Leave a comment