Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help solving this! Discussion Intro: This discussion will cover the concept of lists and functions. Instructions: Download the following file and put it
I need help solving this!
Discussion Intro: This discussion will cover the concept of lists and functions. Instructions: Download the following file and put it in your project folder. inpathtat . The file is in the forrnat "name gpa". Take a look at the data to be familiar with it. Write a progan that does the followine 1. Function (make sure to write the function at the top) Define a function called averageGPA that has one pararneter, a list, called list f GPA. The function chould retum the average epa of the epa's stored in listOfGPA. The average should be rounded to 2 decimal places. 2. Miain Progan: 1. Open the inpat txt file for reading- 2. Create 2 empty lists called stuNanes and gpalist. 3. Write a for hop to iterate bver the data in the file and store the names in the stuNames list and the gpa's in the gpal ist list. (HINT: You will need to use slicing to get the name and gpa seperate; and the append method to add them to each listi) 4. Call the avergeGPA function and pass the epalist to it. 5. Pint cut the average of the gpas in epalist. The average should print the ending zero as shown in the output below. Use the:format method to do this: Yoa should not we any built-in functions in your code that will automatically find the average or sum (exi. sum(h). Inefficient code will lose points. Your outpot thould look like the follawing The average GPA is: 2.40 Program Style Pequirements; Male sure to use zood progamening style (refer to the Style Guidelines under the Start Here Module) Your program should use descriptive variables, effective whinto space, and corments in your progran or you will laye points. Subrssion Instructions 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