Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Python def studentGrades(gradeList): Takes a nested list as an argument and returns a list with the average score for each list in integer

Use Python

image text in transcribed

def studentGrades(gradeList):

"""

Takes a nested list as an argument and returns a list with the

average score for each list in integer format

>>> grades = [

... ['Student', 'Quiz 1', 'Quiz 2', 'Quiz 3'],

... ['John', 100, 90, 80],

... ['McVay', 88, 99, 111],

... ['Rita', 45, 56, 67],

... ['Ketan', 59, 61, 67],

... ['Saranya', 73, 79, 83],

... ['Min', 89, 97, 101]]

>>> studentGrades(grades)

[90, 99, 56, 62, 78, 95]

>>> grades = [

... ['Student', 'Quiz 1', 'Quiz 2', 'Quiz 3','Final' ],

... ['John', 100, 90, 80, 90],

... ['McVay', 88, 99, 11, 15],

... ['Rita', 45, 56, 67, 89],

... ['Ketan', 59, 61, 67, 32],

... ['Saranya', 73, 79, 83, 45],

... ['Min', 89, 97, 101, 100]]

>>> studentGrades(grades)

[90, 53, 64, 54, 70, 96]

>>> grades = [

... ['Student', 'Quiz 1', 'Quiz 2'],

... ['John', 100, 90],

... ['McVay', 88, 99],

... ['Min', 89, 97]]

>>> studentGrades(grades)

[95, 93, 93]

"""

# --- YOU CODE STARTS HERE

# --- CODE ENDS HERE

[5 pts] Write the function studentGrades(gradeList) that takes a nested list with the following structure: First list is always a descriptive header Subsequent lists hold all the data. - For lists that hold data, the first element is always a string, the rest of the elements are numeric values. Each list (except for the first one) represents the grades of the student and the first element of each list contains the name of the student grades ('Student', 'Quiz 1', 'Quiz 2', 'Quiz 3'],# List 1, header [John',100, 90, 80 ['McVay', 88, 99, 1111, ['Rita',45, 56, 67 ['Ketan', 59, 61, 67], I'Saranya', 73, 79, 831, ['Min', 89, 97, 101]] and returns ONE list with the average score for each student in INTEGER format. Hint: The method sum adds all the numeric elements of a list (sum([1,2,8.1]) returns 11.1). grades -[ ['Student','Quiz 1', 'Quiz 2", 'Quiz 3'1, ['John, 100, 90, 80], ['McVay, 88, 99, 111, ['Rita',45, 56, 67], ['Ke 100+90+80 270 270/3 90 tan', 59, 61, 67], a', 73, 79, 83, ['Min', 89, 97, 101]] >>studentGrades (grades) [90, 99,56, 62,78, 95) grades -[ ['Student,"Quiz 1', Quiz 2,'Quiz 3', 'Final' , ['John',100, 90, 80, 90, ['McVay, 88, 99, 11, 15], ['Rita', 45, 56, 67, 89), ['Ketan', 59, 61, 67, 32, ['Saranya', 73, 79, 83, 45], ['Min, 89, 97, 101, 10011 100+908090 360 360/4 90 >>> studentGrades (grades) 90, 53, 64, 54, 70, 96] grades[ ['Student', 'Quiz 1',Quiz 2'], ['John,100, 90], ['McVay, 88, 99], [Min", 89, 97]] 8899 187 187/2 93.5 >>studentGrades (grades) [95, 93, 93]

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

What is human nature?

Answered: 1 week ago