Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program 2 9 : Write a program which : Writes a random number ( 5 0 to 5 5 ) of numbers ( 0 to

Program 29:
Write a program which :
Writes a random number (50 to 55) of numbers (0 to 100) in a file
Opens the file and reads the numbers from it into a list
Sorts the list and Shows it.
Calculates the median.
Note: You may NOT use the Python built in functions: sort(), sorted(), sum(), median().
See the lecture videoLinks to an external site. about files for hints.
Hint to calculate median:
If there is an odd number of data values then the median will be
the value in the middle.
For the data set: 1,1,2,5,6,6,9 the median is 5.
If there is an even number of data values then the median will be
the average of the two data values in the middle.
For the data set: 1,1,2,6,6,9 the median is 4.
The middle two values are 2 and 6, so (2+6)/2=8/2=4

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

Students also viewed these Databases questions