Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that will prompt a user for a filename (nums.tx) and read a sequence of numbers from the file into a list nums.
Write a program that will prompt a user for a filename (nums.tx) and read a sequence of numbers from the file into a list nums. Inputting the numbers is all handled in the function get_nums. The main body then finds the largest value in the list using find_largest, the smallest value in the list using find smallest, and finally writes a report called myreport.txt by calling write report. The skeleton for the code and the format for the report assuming a simple input file are given below. Once you have the output file handle called outfile you write to it using outfile.write. Note that what you write out must be of type string. def get nums (nums) def find largest (nums): #return the largest value in the list def find smallest (nums) #return the smalles value in the list def write report(nums,mymin, mymax) #write the nuns #write the Max value #write the Min value def nain() nuns [ get nums (nums) nymax find largest (nums) nynin find smallest (nums write report (nums, mymin, mymax) main)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started