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
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