1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Helen [10]
2 years ago
5

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.

Computers and Technology
1 answer:
Setler [38]2 years ago
4 0

Answer:

Check the explanation

Explanation:

def get_list_of_integers_from_file(filename):

int_list=[]

for line in open(filename).readlines():

try:

int_list.append(int(line))

except:

continue

return int_list

print(get_list_of_integers_from_file('file.txt'))

 

File.txt:

Kindly check the output below.

You might be interested in
When measuring processor speed,a megahertz is much faster than a gigahertz.true or fals
Nat2105 [25]

Answer: False

Explanation:

The statement in the question is wrong. When measuring processor speed, a megahertz is slower than a gigahertz.

We should note that:

1 megahertz = 1 million cycles per second

1 gigahertz = 1 billion cycles per second.

Therefore, we can see that a gigahertz is faster than a megahertz.

4 0
2 years ago
A Chain of dry-cleaning outlets wants to improve its operations by using data from devices at individual locations to make real-
Svetllana [295]

The technology would the business combination with its current cloud operations to make this possible are ERP and loT.

<h3>What is the ERP?</h3>

Enterprise resource planning (ERP) refers to a shape of a software program application that companies use to manipulate each day industrial organization sports activities in conjunction with accounting, procurement, task management, chance manage and compliance, and supply chain operations.

  1. Given the organization has a cloud setup, we need a company solution (ERP system) which needs to be to be had to all stores and loT to build up facts from devices and deliver it over to the ERP system.
  2. This will help to connect records at some crucial databases in cloud from all the stores.
  3. There need to be record protection features as well to maintain the records intact, all profits features need to be incorporated and tested.

Read more about the ERP :

brainly.com/question/14635097

#SPJ1

7 0
2 years ago
it just said i was blocked from brainly for a sec i was like- dang- then i logged in again then it was back to normal uHhHh can
PSYCHO15rus [73]

Answer:

it has been doing the same to me if your on a school computer at home then it will bug sometimes but if you were at school then it would probably be entirely blocked but idrk

Explanation:

5 0
2 years ago
Read 2 more answers
If you use the assign software to a user option, how does the new software install to the user's computer? 70-411
Serggg [28]
Hi,

If you install a new software and you select option for all users the software will be installed in a special folder that is shared by all the users and each user would represent a subfolder in the shared folder.

Hope this helps.
r3t40
3 0
2 years ago
Detecta 1 problema
Komok [63]

Answer:

En el factor secundario el problema es la contaminación ambiental y (o) polución.

Explanation:

No solo dentro de las industrias, si no que en todos lados...

Una manera de contrarrestar este problema es reducir el uso de recursos no renovables y utilizar los renovables. En forma de ahorro, los no renovables se podran producir un poco mas y podriamos mantener un buen ciclo de uso.

Espero te sirva!!

3 0
2 years ago
Read 2 more answers
Other questions:
  • Bullets in a text box will do which of the following?
    9·1 answer
  • I’m nobody. Who are you?
    9·2 answers
  • before Katie turns in the paper she typed she wants a peer to review it and give her feedback Katie uses her all in one printer
    10·1 answer
  • Jack lost all the data he saved on his desktop because of a power outage while working on a presentation. On which of these comp
    15·2 answers
  • Develop a program that will maintain an ordered linked list of positive whole numbers. Your program will provide for the followi
    13·1 answer
  • List at least 5 professions for people working in the Information/Communication<br> fields.
    10·1 answer
  • Pleaseeeeeeeee I will give a brainliest
    7·1 answer
  • What word can you type using only the left home row keys and the right reach keys?
    6·2 answers
  • I'm getting pretty desperate plz help me, I'll give brainiest, and ill make a free question worth 100 points this is for coding
    10·1 answer
  • CreatePolicies<br> I need help with this in java.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!