Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

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

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

Why is it so difficult to implement effective IMC?

Answered: 1 week ago