Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function named analyse_scores (list_of_scores) that reads a list of scores and determines how many scores are above or equal to the mean and

image text in transcribedimage text in transcribed

Write a function named analyse_scores (list_of_scores) that reads a list of scores and determines how many scores are above or equal to the mean and how many are below the mean. The function should print out the analysis in the format specified below. It should print 'Invalid list' if the list is empty Format: Meanffloating point score rounded and displayed to 2 dp usi ng python rounding N above meanfinteger valuej) N below meanfinteger valuej) Your function must produce the output exactly as specified above, with actual values replacing the description inM Note that displaying to 2dp should be interpreted as displaying a mean of 5.0 as 5.00. All mean values should have 2 digits after the decimal point. For example Test Result analyse_scores (I40, 55, 70, 58]) Mean 55.75 N above mean : 2 N below mean 2 analyse_scores ([51, 65, 66, 80, 10, 55]) Mean 54.50 N above mean :4 N below mean 2 analyse_scores([]) Invalid list 1 def analyse_scores(list_of_scores): sum = 0 if len (list-of-scores) 3-1 4 5else: -e: print("invalid list") number-float (len(list_of_scores)) for i in range(len(list_of_scores)) sum list_of_scores[i] mean sumumber mean = float (round(mean, 2)) a = int (sum(! > mean for i in list of scores b-int(sum i

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions