subject

The function below tries to create a list of integers by reading them from a file. The file is expected to have a single integer per line and the code works correctly in that case. If any of the lines don't contain just an integer, than this code fails. Fix this code so that it ignores any lines that don't contain integers instead of raising an exception. Do this with try/except blocks. Your code should still return the list of integers from the lines that contain integers. student. py 1- def get list of_integers from_file(filename): int list - for line in open(filename).readlines (): int list. append (int (line)) return int list 12

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:50
Which of the following had the greatest influence on opening the internet to the generly public
Answers: 1
question
Computers and Technology, 22.06.2019 11:10
The total cost of textbooks for the term was collected from 36 students. create a histogram for this data. $140 $160 $160 $165 $180 $220 $235 $240 $250 $260 $280 $285 $285 $285 $290 $300 $300 $305 $310 $310 $315 $315 $320 $320 $330 $340 $345 $350 $355 $360 $360 $380 $395 $420 $460 $460
Answers: 2
question
Computers and Technology, 22.06.2019 18:30
Kto rozmawia z clamentain przez krótkofalówke w the walking dead która śledzi lee w 4 epizodzie
Answers: 1
question
Computers and Technology, 24.06.2019 09:30
Retype the statements, correcting the syntax errors. system.out.println("num: " + songnum); system.out.println(int songnum); system.out.println(songnum " songs"); note: these activities may test code with different test values. this activity will perform two tests: the first with songnum = 5, the second with songnum = 9. see how to use zybooks.
Answers: 1
You know the right answer?
The function below tries to create a list of integers by reading them from a file. The file is expec...
Questions
question
Computers and Technology, 23.09.2019 10:30
question
Mathematics, 23.09.2019 10:50
question
Mathematics, 23.09.2019 10:50
question
Mathematics, 23.09.2019 10:50
Questions on the website: 13722362