Computers and Technology
Computers and Technology, 19.07.2021 19:20, bugbug26

PYTHON CODE ONLY The Program Spec
Write a program that enforces the following expectations of a data set file:
The file must exist
The data in the file must have the following format:
The file must start with an integer, n
The file must contain n data values
The program prompts the user for the name of a file. The file is expected to contain data values. The first line of the file should contain the total number of values, and the remaining lines contain the data.
Three key potential errors to program for include:
The file might not begin with an integer
There might not be a sufficient number of data values
There may be additional input after reading all data values
For a valid data file, the processing data task is to compute the sum of all the data values in the file. Print out a result message and resultant sum for a valid data file.
Deliverable: yournameLab6.py Your source code solution and a copy of the run pasted into your source submission file. Be sure to comment out your run so that your .py file will still run in the grader test bed.
Input Error Checking: 5 test files are provided to use as test cases for your program. 4 test cases are expected to raise exception conditions. 1 test case is a valid data set. The test files include: bad1.dat bad2.dat bad3.dat bad4.dat good. dat
Test Run Requirements: Use the provided 5 test files as your test run validator.
Here are some other tips and requirements:
1. Keep provided test files intact
2. Use a while loop to run all 5 test files as your input test suite to generate submission run output
3. Provide an appropriate display message both for invalid and valid data files.
Here is a sample partial run:
$ python3 demo6.py
Please enter the file name: err1.dat
Error: file contents invalid.

Please enter the file name: err2.dat
Error: End of file expected.
Please enter the file name: valid. dat
The sum is 145
bad1.dat
10 1 2 3 4 5 6 7 8 9
bad2.dat
ten 1 2 3 4 5 6 7 8 9
bad3.dat
10 one 2 3 4 5 6 7 8 9
bad4.dat
10 1 2 3 4 5 6 7 8 9 10 11
good. dat
10 1 2 3 4 5 6 7 8 9 10

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 16:10, katherineweightman
When copying and pasting text, the first step is move your cursor type the text select the copy command select the paste command
Answers: 2
image
Computers and Technology, 22.06.2019 20:00, ksanchez2100
Need asap assignment directions: think of an organization (business, religious institution, volunteer organization, sports team) with which you have been involved. imagine outfitting it with an it infrastructure. prepare a plan for what you would do to support outfitting it. draw a map of a network connecting all the individuals, give them pcs and printers, and lay out the design as best you can. the purpose is to begin working with these concepts, not to build a perfect network.
Answers: 2
image
Computers and Technology, 22.06.2019 22:40, nsuleban9524
When you type the pwd command, you notice that your current location on the linux filesystem is the /usr/local directory. answer the following questions, assuming that your current directory is /usr/local for each question. a. which command could you use to change to the /usr directory using an absolute pathname? b. which command could you use to change to the /usr directory using a relative pathname? c. which command could you use to change to the /usr/local/share/info directory using an absolute pathname? d. which command could you use to change to the /usr/local/share/info directory using a relative pathname? e. which command could you use to change to the /etc directory using an absolute pathname? f. which command could you use to change to the /etc directory using a relative pathname?
Answers: 3
image
Computers and Technology, 25.06.2019 16:10, zahrast14
4the time needed to complete a hole in golf is estimated to be 25 minutes.how long, in hours and minutes, will it take to complete 13 holes in a game?
Answers: 1
Do you know the correct answer?
PYTHON CODE ONLY The Program Spec
Write a program that enforces the following expectations of...

Questions in other subjects:

Konu
Mathematics, 06.03.2020 14:12
Konu
Mathematics, 06.03.2020 14:13