Question: Assignment / - Reaaing from files, storing inside a LIST as you create functions. RESOURCES: Chapter 5 - FUNCTIONS / MODULES; Chapter 7 - Creating
Assignment Reaaing from files, storing inside a LIST as you create functions.
RESOURCES: Chapter FUNCTIONSMODULES; Chapter Creating A List of valuesobjects
Videos, sample pseudocode, and python programs under Week #
Worth points
PROBLEM DESCRIPTION: & PURPOSE
Continue to define functions where appropriate:
Store functions in separate customized file
Read numerical data from a file and store inside a list,
store as a list, manipulate it using statistical functions and
write results to an output file.
Write a python program that will read a list of daily rain falls and store inside a list data structure. The program must include at
least four different customized functions.
DESIGN:
Use either:
a A flowchart program such as flowgorithm or Visio or similar program or
b Pseudocode to design and solve the problem.
Save the pseudocode or flowchart as:
LastnamefirstnameARainFallListDesign
PYTHON CODE:
Express the design using python or higher. Save the source code of python as:
Last PROCESSING:
Create a main function for the main program.
Use the files for opening files for reading and writing from the InfnCustomizedFunctions.py
Create a function that reads the data from the rainfallrevised file and stores positive numerical data inside a list called
rainfall.
Write the appropriate headings as shown in the list inside the file for writing output
LastnamefirstnameARainFallListOutput.txt
Create a function to write the unsorted list of rainfalls.
Use the builtin function sorted to sort the list in ascending order
Write the heading for the sorted list.
Write the actual sorted rainfall list.
Use the builtin function len to determine the number of rainfalls inside the list.
Use the builtin function mean to find the average rainfall.
Use the builtin function min to determine the minimum rainfall in the list.
Use the builtin function max to determine the maximum rainfall in the list.
Note you may use the with clause readwrite data to files as they do not require a close statement. But they still need to
be set up as different functions.
You may use the while loop version or for loop to read the different daily rainfalls.
Once you create the functions, please call them in the program and test the program.
Step # remove only the sub functions from the main program. DO NOT REMOVE THE MAIN FUNCTION from your
source code. and save them to a separate python file called:LastnamefirstnameCustomFunctions.py
At the beginning of the main source program with the main function you will import the:
LastnamefirstnameCustomFunctions.py
inside this main source:
program LastnamefirstnameARainFallList.py
use the following statement
from LastnamefirstnameCustomFunctions import
Make sure this statement is placed at the beginning of your Source program outside the main function.
DO NOT INCLUDE THE py when importing a file in the main source code of python.
If in doubt, view the videos under Week along with previous videos from week #namefirstnameARainFallList.py
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
