Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question-3: Write a Python function named calc_mark() that takes a students individual quiz marks out of 10 in a string separated by a comma &

Question-3: Write a Python function named calc_mark() that takes a students individual quiz marks out of 10 in a string separated by a comma & multiple spaces. The function then calculates & returns his/her final quiz mark. You can assume the minimum number of quizzes taken is 2. Lets say, there were a total n number of quizzes taken. The final quiz mark will be calculated as follows: If n equals or less than 3, then final_mark = average mark of best (n-1) quizzes Otherwise, final_mark = average mark of best (n-2) quizzes [You are not allowed to use built-in functions sum(), max(), min() to solve this problem.] ================================================ Function Call 1: calc_mark("7 , 9 , 6 , 8 , 7") Sample Output 1: Given marks: [7, 9, 6, 8, 7] 8.0 Explanation 1: Since the total number of quizzes is greater than 3, the final mark will be: (9 + 8 + 7) / 3 = 8.0 which will be returned and printed in the function call. ================================================ Function Call 2: calc_mark("10 , 6 , 8") Sample Output 2: Given marks: [10, 6, 8] 9.0 Explanation 2: In this case, the final mark will be: (10 + 8) / 2 = 9.0 which will be returned and printed in the function call.

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_2

Step: 3

blur-text-image_3

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

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions