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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started