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 08:30
On the loan worksheet in cell c9 enter pmt function to calculate the monthly payment for the altamonte springs 2018 facilities loan. ensure that the function returns a positive value and set the reference to cells b5 and b6 as absolute references.
Answers: 2
question
Computers and Technology, 23.06.2019 02:30
How to launch an app: steps to be successful? launching an app is a great idea, but itโ€™s not that easy as we supposed to think. the majority of mobile applications donโ€™t generate revenue because companies arenโ€™t ready to be competitive. referring to our experience in successfully building and launching apps we hope to you omit these difficulties. we are going to talk about ideas, marketing, testing your product, its development, distribution and support. you will learn 8 product launch stages to succeed.
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
You are consulting for a beverage distributor who is interested in determining the benefits it could achieve from implementing new information systems. what will you advise as the first step?
Answers: 1
question
Computers and Technology, 23.06.2019 09:10
Effective character encoding requires standardized code. compatible browsers. common languages. identical operating systems.
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
Mathematics, 21.11.2020 03:50
question
Mathematics, 21.11.2020 03:50
question
Mathematics, 21.11.2020 03:50
question
Mathematics, 21.11.2020 03:50
question
Mathematics, 21.11.2020 03:50
Questions on the website: 13722363