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
MatroZZZ [7]
3 years ago
15

Modify the program you wrote for Chapter 6 Exercise 6 so it handles the following

Computers and Technology
1 answer:
Basile [38]3 years ago
6 0

Answer:

#try except

try:

   #opening the file

   read_file = open('numbers.txt', 'r')

   #Store the numbers in the variable file_numbers.

   file_numbers = read_file.read()

   #close the file

   read_file.close()

   #Split the number of files in list_values.

   list_values = file_numbers.split()

   #how many numbers are there

   list_length = len(list_values)

   try:

       #loop it up

       for i in range(list_length):

           list_values[i] = float(list_values[i])

       #Add up all the numbers, put into list_sum

       List_sum = sum(list_values)

       #heres how we average it

       Average_value = (List_sum)/list_length

       #print

       print(Average_value)

   except ValueError:

       print( "File must have only numbers. Try again." )

   #handles IOError exceptions

except IOError:

   #Display statement

   print("Trouble opening file. Try again.")

Explanation:

The python program uses the try-except exception handling method to catch errors in the code. The IOError is used for catching input and output errors in the program like file handling while the ValueError keyword in the except statement is used to catch data type errors from a return statement, calculation or user input.

You might be interested in
How do you use loops in code?
Keith_Richards [23]

Answer:

A loop in a computer program is an instruction that repeats until a specified condition is reached. In a loop structure, the loop asks a question. If the answer requires action, it is executed. ... A computer programmer who needs to use the same lines of code many times in a program can use a loop to save time

Explanation:

4 0
3 years ago
Write a summary, on the requirements for a home automation IoT network discussing whether Wi-Fi is the best network option, by c
Wewaii [24]

Answer:

following are the answer to this question:

Explanation:

In the given question, firstly we focus solely on the smart homes IoT systems criteria, that can access the whole IoT notion throughout two ways, which be defined as follows:

Initially, whenever it links with the smart home includes ventilation, flower arranging, smart house appliances, device, and the designers will use search engine support, etc. all of this, including several, includes certain components like sensors, hubs, doorbells, fire detector.

In the second way the cloud control devices described from first are provided, however, manufactures should be recorded here through cloud computing, and when the process, entirely controlled, can easily be managed remotely, because it is first performed.

The Zigbee is a great priority when it comes to energy usage due to the extremely reduced wattage or battery capacity, and when it comes with wifi capacity, the best solution is Zigbee and it is too expensive with memory footprint 9 because this is also a very big one) It also allows all of the implements to enter even before wifi permits.  

Even so, in wifi, we will not ever realize if it will fall to the ground, however in ZigBee and at the start, they only have to pay tremendous like wifi but it has some repayment options, that lead the user can decide whatever they want. It can pay for our consumption levels.

5 0
3 years ago
In popular usage and in the media, the term ________ often describes someone who breaks into a computer system without authoriza
ch4aika [34]
The answer here is hacker
6 0
3 years ago
What is one problem you should keep in mind when researching information on the Internet?
shepuryov [24]
The answer is A due to the internet being a plethora of information being accessed by anyone and everyone with internet access. Any person of no background to certain information could claim mastery to the field and sway his/her audience to ways possible. Ensuring that the source of the information being read is from credible and reputable companies. You can do this by ensuring the information is from newspapers with names known all over the world or there are also sourced footnotes from the author where they could have cited some information from other articles. 
5 0
3 years ago
Read 2 more answers
The computers found in DVD players, thermostats, answering machines, and some appliances are known as ____.
Pani-rosa [81]
The computers found in DVD players, thermostats, answering machines, and some appliances are known as embedded computers.
So the answer is <span><span>d. embedded computers</span></span>
5 0
4 years ago
Other questions:
  • In Microsoft Excel graphs are referred to as ______?
    14·2 answers
  • What was Leonardo da Vinci an expert in
    11·1 answer
  • The acronym LAH stands for
    14·2 answers
  • A Windows user has been successfully saving documents to the file server all morning. However, the latest attempt resulted in th
    9·2 answers
  • 6.3 code practice: Question Edhesive
    8·1 answer
  • What is a non-example for job application???
    11·1 answer
  • Write the output of the following program:
    8·1 answer
  • Mention how to install antivirus software in your computer, either by following the instructions given on installation CDs or we
    6·1 answer
  • Which of the following does NOT describe the characteristics of cyberbullying?
    15·2 answers
  • Write a program in Java programming language to display or calculate “Hello, Daddy and Mum”
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!