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
In Microsoft Excel, you have a large dataset that will print on several pages. You want to ensure that related records print on
spin [16.1K]

Answer:

The answer is "Option D".

Explanation:

In Microsoft Excel, A dataset is a collection of the data. In other words a dataset is set of data like, Excel workbooks, spreadsheet tables, or table lists that are configurable objects storing the data. To print data sets related records on the same page we change the print at this data set only print the visible data, it will not print the confidential data. and other options are not correct that can be defined as follows:

  • In option A, It is not correct, because the set area used to select the area which you want to print.
  • In option B, It is used to print the same data on each page. it is not used in print page order.
  • In option C, This option is available on the Home tab that is used for page break only that's why it is not correct.
4 0
3 years ago
Create a trigger that prevents anychange(insert, update, or delete)to the grade attribute of the takesrelation that would change
Alchen [17]

Answer:

The trigger code is given below

create trigger F1_Del

after delete on Friend

for each row

when exists (select * from Friend

where ID1 = Old.ID2 and ID2 = Old.ID1)

begin

delete from Friend

where (ID1 = Old.ID2 and ID2 = Old.ID1);

end

create trigger F1_Insert

after insert on Friend

for each row

when not exists (select * from Friend

where ID1 = New.ID2 and ID2 = New.ID1)

begin

insert into Friend values (New.ID2, New.ID1);

end

5 0
3 years ago
Please program this in Python.
Temka [501]

lst = ["Star Wars", "Movie 2", "Movie 3", "Movie 4"]

print(lst[0])

I wrote my code in python 3.8. Best of luck

5 0
3 years ago
which tag does not display the text in the browser window and makes the sources code mode readable ?​
maxonik [38]

Answer:

HTML comments are not displayed in the browser, but they can help document ... You can add comments to your HTML source by using the following syntax: <! ... you can comment out HTML lines of code, one at a time, to search for errors: ... Use the HTML comment tag to make a comment out of the "This is a comment" text.

Explanation:

Gimme brainliest right now.

3 0
3 years ago
Which term refers to a fact that naturally occurs in the universe?
MrMuchimi

Answer: a scientific law

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • It is appropriate to leave sections of an application blank ?<br><br><br><br> True or False
    7·1 answer
  • Which of the following is NOT a view which can be chosen for a presentation?
    15·1 answer
  • Why do most programmers indent the conditionally executed statements in a decision structure?
    7·1 answer
  • Brent is using customer reviews from a reputable online store to help him determine whether or not he should buy a particular la
    10·1 answer
  • A peer-to-peer (p2p) network is an example of ________ administration
    5·1 answer
  • g 18.6 [Contest 6 - 07/10] Reverse an array Reversing an array is a common task. One approach copies to a second array in revers
    8·1 answer
  • People are not interested in what you do _____. I think, more and more, they're not even really interested necessarily in how yo
    8·1 answer
  • 5. What must be included in Turtle Graphics to move the Turtle around the screen?
    7·1 answer
  • Spreadsheet allow three types of cell addressing. They include ______addresses, such as $E$1, ______addresses, such as R$3, and
    12·1 answer
  • 0 -10°
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!