Question: Hi, I am trying to get write the code for my first CS 162 project, and would like some help on the following prompt: project-1

Hi, I am trying to get write the code for my first CS 162 project, and would like some help on the following prompt:

project-1

For this project,you willimportthestatisticsmodule.

Write a class called Student that has twoprivatedata members-the student's name and grade.It should have an init method that takes two values and uses them to initialize the data members.It should have aget_grademethod.

Write a separate function(not part of the Student class)calledbasic_statsthat takes as a parameter a list of Student objects and returns a tuple containing the mean,median,and mode of all the grades.To do this,use the mean,median and mode functions in the statistics module.Yourbasic_statsfunction should return those three values as a tuple,in the exact order given above.

As an example,your code could be called as follows by the grader:

s1 = Student("Kyoungmin", 73) s2 = Student("Mercedes", 74) s3 = Student("Avanika", 78) s4 = Student("Marta", 74) student_list = [s1, s2, s3, s4] print(basic_stats(student_list)) # should print a tuple of three values 

You can test your program with the above example but make sure to not leavethat as part of your submission.

The file must be named:basic_stats.py

Mini-review:A private data member of a class has a name that begins with an underscore.Private data members can be directly accessed from within the class,butnotfrom outside the class.Instead,if a data member needs to be accessed or manipulated from outside the class,then the class should provide a method that can be called to carry out the necessary actions.This access restriction is not enforced by the Python language as it is in some other languages,due to the Python philosophy of"we're all adults here".

The coding requirements are in the link below:

https://canvas.oregonstate.edu/courses/1830120/pages/code-style-requirements?module_item_id=21377090

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 Programming Questions!