I HAVE 2 PART LAB complete the following programming exercises.
Question Description
Lab 1 PART A
complete the following programming exercises.
file into a list. The program should then process the numbers in the list and display the following information:
Notes There are several issues that will be need to be addressed to make lab 3 work:
- A line break (n)exists at the end of each record (row) . When reading the file, use the method replace() to replace line breaks with null (“”)
- Records on the file are stored as strings. When reading the file, use the method int() to convert the strings back to ints.
LAB 1 PART B
- Write a program that writes a series of random† integers, one per line, to a file. Each random number should be in the range of 1 to 500. The application should first prompt the user to specify how many random numbers the file should hold. Include a custom try/exception block to verify that the user entered a number > 0. Include a try/exception block to verify that the user entered an integer. Note: records must be stored as strings – see method str()
- (Extra Credit) Write a program that takes as input the file statesPopulation.txt. Add to a list and report. :
-
- format: state, population, abbreviation
- Sort by state name
- Report on state name and population (consider method split())
- Format population with commas (convert to int)
Save your programs in plain text files and submit these by the due date/time.
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."