Question: For my intro to programming class, we are to create this assignment in Python. However, I have been having a lot of problems creating this.
For my intro to programming class, we are to create this assignment in Python. However, I have been having a lot of problems creating this.
In this programming assignment you will create two programs. One will write a set of random numbers to a file. The second will read a set of random numbers from a file, count how many were read, display the random numbers, and display the total count of random numbers.
Random Number File Writer Create a program called randwrite.py that writes a series of random numbers to a file. Each random number is to be on a separate line and is to be in the integer number range of 1 through 999. The program is to request from the user how many random numbers to generate. The file that the random numbers are written to is to be called randnum.txt. The user input is to be safe from crashes from invalid input. The user must enter a positive number for the quantity of random numbers to generate. If invalid input is received the user is to be given feedback and provided with the ability to enter a value again. (A positive number is not zero and not negative.) The program must not crash if an error occurs during a file operation. Use exception handling.
Random Number File Reader Create a program called randread.py that reads a series of random numbers from a file called randnum.txt, counts how many there are, displays the random numbers, and displays the count. The output to the user is to be labeled and nicely formatted. Prior to displaying the random numbers display List of random numbers in randnum.txt: Each random number is to be displayed on a separate line. The count displayed to the user is to be preceded with Random number count.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
