Question: Write a Python 3 program according to the following: Create a class for a Student, that contains a first name, a last name, and an

Write a Python 3 program according to the following:

  • Create a class for a Student, that contains a first name, a last name, and an id.

  • Create an __init__ function in your class that initializes the first name, last name, and id to "", "", and 0, respectively.

  • Create a regular function (not a member function just yet) called prompt_student that creates a new student object, then prompts the user for a first name, last name, and id. The function should assign these to the appropriate properties of the object and return it.

  • Create a regular function (not a member function) called display_student that accepts a student object, and displays its information in the following format: "id - FirstName LastName".

Then, create a main function that does the following:

  • Calls the prompt_student function and saves the returned value in a variable called "user".

  • Pass the user object to the display_student function to be displayed.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!