Question: Python Programs (Files Questions) Using python 3 functions and files 1. Line Numbers; It should be able to handle IOError and ValueError exceptions. Write a

Python Programs (Files Questions)

Using python 3 functions and files

1. Line Numbers; It should be able to handle IOError and ValueError exceptions.

Write a program that asks the user for the name of a file. The program should display the contents of the file with each line preceded with a line number followed by a colon. The line numbering should start at 1.

2. Random Number File Writer

Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 500. The application should let the user specify how many random numbers the file will hold.

3. Use the file you have created in the previous question. Write a program that calculates the average of all numbers, and reports how many numbers are there that are greater than 250 and sum of all numbers smaller than 250.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!