class PersonData: init_(self): self.last_name self.age_years def = 0 def set_name (self, user_name): self.last_name = user_name def set_age (self, num_years): self.age_years = num_years # Other parts...


PTHYON: BASIC INHERITANCE


Set course_student's last_name to Smith, age_years to 20, and id_num to 9999.


Sample output for the given program:Name: Smith, Age: 20, ID: 9999


class PersonData:<br>init_(self):<br>self.last_name<br>self.age_years<br>def<br>= 0<br>def set_name (self, user_name):<br>self.last_name<br>= user_name<br>def set_age (self, num_years):<br>self.age_years = num_years<br># Other parts omitted<br>def print_all(self):<br>output_str = 'Name:<br>return output_str<br>+ self.last_name + ', Age:<br>+ str(self.age_years)<br>%3D<br>

Extracted text: class PersonData: init_(self): self.last_name self.age_years def = 0 def set_name (self, user_name): self.last_name = user_name def set_age (self, num_years): self.age_years = num_years # Other parts omitted def print_all(self): output_str = 'Name: return output_str + self.last_name + ', Age: + str(self.age_years) %3D
class StudentData(PersonData):<br>init (self):<br>def<br>_init_(self)<br># Call base class constructor<br>PersonData.<br>self.id_num<br>= 0<br>def set_id(self, student_id):<br>self.id_num = student_id<br>def get_id(self):<br>return self.id_num<br>course_student =<br>StudentData()<br>'' Your solution goes here '''<br>print('{}, ID: {}'.format(course_student.print_all(), course_student.get_id()))<br>

Extracted text: class StudentData(PersonData): init (self): def _init_(self) # Call base class constructor PersonData. self.id_num = 0 def set_id(self, student_id): self.id_num = student_id def get_id(self): return self.id_num course_student = StudentData() '' Your solution goes here ''' print('{}, ID: {}'.format(course_student.print_all(), course_student.get_id()))

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here