The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 314 Weeks Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Computer Science question
Â
In this programming assignment you will create two python programs. 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.
part 1
Random Number File Writer
Write a program called randomwrite.py that writes a series of random numbers to a file. The program is to request from the user how many random numbers to generate, the lower bound of the random numbers' range, and the upper bound of the random numbers' range. Each random integer number is to be on a separate line and is to be in the range of the inputted lower bound through the inputted upper bound. The file that the random numbers are written to is to be called randomnum.txt.
The user input is to be safe from crashes from invalid input. The user must enter a positive number for all required input (quantity of random numbers to generate, the lower bound of the random numbers' range, and the upper bound of the random numbers' range). 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.
output
Example:
How many random numbers do you want? 5
What is the lowest the random number should be: 1
What is the highest the random number should be: 100
The random numbers were written to randomnum.txt
part 2
Write a program called randomread.py that reads a series of random numbers from a file called randomnum.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 randomnum.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:.
 Â
Example:
List of random numbers in randomnum.txt:
5
8
35
21
23
Random number count: 5
Â
- Hoping you could write the program so that I can see how it should look when typed in python.
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly