Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

class Student: def _ _ init _ _ ( self , firstname, lastname, major, year ) : self.firstname = firstname self.lastname = lastname self.major =

class Student:
def __init__(self, firstname, lastname, major, year):
self.firstname = firstname
self.lastname = lastname
self.major = major
self.year = year
def describe_self(self):
return f"{self.firstname}{self.lastname}{self.major}{self.year}"
class Student_athlete(Student):
def describe_self(self):
return f"{self.firstname}{self.lastname}{self.major}{self.year} Athlete"
# Create an object Student1 that is an instance of the class Student
Student1= Student("Helen", "Smith", "CIS", "Senior")
print(Student1.describe_self())
# Create an object Student2 that is an instance of the subclass Student_athlete
Student2= Student_athlete("John", "Smith", "CIS", "Senior")
print(Student2.describe_self())

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

1. What are the major sources of stress in your life?

Answered: 1 week ago