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
Type the correct answer in the box. Spell all words correctly.
Alekssandra [29.7K]

Answer:

kinesthetical

Explanation:

please give brainliest please and good luck :)

8 0
1 year ago
A SOHO's connection to the internet is through an antenna that sends and receives a microwave signal to the ISP's antenna. There
aksik [14]

Answer:

Line of sight wireless

Explanation:

Line of sight wireless are wireless which enable antenna to sends and receives a microwave signal to the ISP's antenna

By standing between the mounted antenna at client building so that the other side of the wireless connection you intend to create can be visible.

Line of Sight wireless also provide electro-magnetic radio waves that tends to be less affected by external forces leading to better connection reliability because all wireless networks excel only with true line of sight that is why it is always advisable that the antennas are mounted above the tree line, to ensure proper connections without obstacles between them since

Line of sight depend on having a clear line of sight between the antenna and the hotspot .

3 0
3 years ago
To solve the difficulty of scaling memory organization, memories are physically organized into a ____-dimensional organization.
Brums [2.3K]

Answer: two

Explanation:

Organizational memory is simply referred to as the accumulation of data or information that have been created for a particular organization.

To solve the difficulty of scaling memory organization, memories are physically organized into a two dimensional organization.

3 0
2 years ago
Help ASAP!!Choose all the basic elements of algorithms. A.Selection B.Loops C.Flow Charts D.Sequencing E.Combinations F.Iteratio
serg [7]

Answer:

b c d

Explanation:

8 0
3 years ago
Read 2 more answers
Write code which takes a user input of a String and an integer. The code should print each letter of the String the number of ti
Alexus [3.1K]

import java.util.Scanner;

public class JavaApplication70 {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Input a String:");

       String txt = scan.nextLine();

       System.out.println("Input an integer:");

       int num = scan.nextInt();

       String newTxt = "";

       int w = 0;

       for (int i = txt.length()-1; i >= 0; i--){

           char c = txt.charAt(i);

           while (w < num){

               newTxt += c;

               w++;

           }

           w = 0;

       }

       System.out.println(newTxt);

   }

   

}

I hope this helps!

7 0
3 years ago
Read 2 more answers
Other questions:
  • The amount of interest you will earn in one year from a savings account is the _____. A) APY B) return C) IDA D) CD
    12·2 answers
  • Refer to the following code segment. You may assume that array arr1 contains elements arr1[0],arr[1],...,arr[N-1], where N = arr
    8·1 answer
  • . Write a function called is_sorted that takes a list as a parameter and returns True if the list is sorted in ascending order a
    14·1 answer
  • Someone once observed that "the difference between roles and groups is that a user can shift into and out of roles, whereas that
    13·1 answer
  • Write a function shampoo_instructions() with parameter num_cycles. If num_cycles is less than 1, print "Too few.". If more than
    9·1 answer
  • The goal expressed in this definition states that data visualization is about ______ . 1. Interpreting 2. Perceiving 3. Facilita
    6·1 answer
  • Write a program to randomly fill an array of float of 10 elements (use the rand() function and make sure to use #include ) in ma
    11·1 answer
  • 460N of force is exerted on an object with a surface area of 2,5m.How much pressure is felt by the object?​
    11·2 answers
  • When using correct ergonomic technique be sure to _____.
    11·2 answers
  • 25 Points Asap <br> Write a Java program named Light.java that displays a light bulb shown below:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!