Question: Python 3.6 Write a program, addNums(ifile), which will take a file and return the sum of any positive numbers in the file. When the program

Python 3.6

Write a program, addNums(ifile), which will take a file and return the sum of any positive numbers in the file. When the program finds a non-numeric it will keep count of the number of non-numerics it finds in the file, continue to process the file and return a list consisting of the number of bad inputs followed by the sum of the numbers. Using a try/except, the program will return a [-1, 0] when there is a file not found error. You are required to use a try/except to check for any file not found and you are required to use a try/except as an error check for addition with a non-numeric character

Python 3.6 Write a program, addNums(ifile), which will take a file and

smallMixed txt

a b c d e 100 199 10 22 fg hi jk lm no 99 88 77 66 55

mixedAlpha.txt

a z b y 1 26 2 25 c x d w 3 24 4 23 e v f u 5 22 6 21 g t h s 7 20 8 19 i r j q 9 18 10 17 k p l o 11 16 12 15 m n 13 14

addNurms ("smallMixed.txt") [10 716] add Nums mixed Alpha .txt") 26 351] addNums ("nosuch file.txt") I-1 01

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!