answer.
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
Anit [1.1K]
2 years ago
12

Describe how catching exceptions can help with file errors. Write three Python examples that actually generate file errors on yo

ur computer and catch the errors with try: except: blocks. Include the code and output for each example in your post. Describe how you might deal with each error if you were writing a large production program. These descriptions should be general ideas in English, not actual Python code.
Computers and Technology
1 answer:
vovangra [49]2 years ago
8 0

Answer:

Three python errors are; import error, value error, and key error.

Explanation:

Errors occur in all programming languages and just like every other language, python has error handling techniques like the try and except and also the raise keyword.

A value error occurs when an output of a variable or expression gives an unexpected value. Import error results from importing a module from an unknown source while a key error is from a wrong input keypress.

Catching these errors and raising an error gives more control and continuity of the source code.

You might be interested in
A school librarian has been asked to identify inappropriate Internet usage. Which students would most likely be reported to the
adoni [48]

Answer:

a student who researches various websites that show how to gamble online

a student who visits a special website with step-by-step directions on how to make a bomb

a student who posts jokes online about the cultural heritage of other students

Explanation: These are all most likely against school policy. In fact attempting to make a bomb is illegal.

5 0
2 years ago
Read 2 more answers
Assignment 1 is to write a program that will write the lyrics to "X number of beers on the wall". Use only the main method. Prom
g100num [7]

Answer:

// here is code in java.

import java.util.*;

class Main

{

// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

       // variable to store the number of bottles

       int num_bot;

        Scanner scr=new Scanner(System.in);

        System.out.print("Enter number of bottles of beer on the wall:");

        //read the number of bottles

        num_bot=scr.nextInt();

        // print the output

        for(int i=num_bot;i>0;i--)

        {

         // print the first statement

         System.out.println(i+" beer bottles on the wall");

         // print the second statement

         System.out.println(i+" beer bottles . Take 1 down and pass the bottle around.");

         }

         // when there is 0 bottle

           System.out.println("0 bottles of beer on the wall.");

   }catch(Exception ex){

       return;}

}

}

Explanation:

Declare a variable "num_bot" to store the initial number of beer bottles.Then ask user to give number of bottles.Run a for loop to pass a beer bottle until there is 0 bottle on the wall. When number of bottle is 0 then it will print there is "0 bottle on the wall".

Output:

Enter number of bottles of beer on the wall:3

3 beer bottles on the wall

3 beer bottles . Take 1 down and pass the bottle around.

2 beer bottles on the wall

2 beer bottles . Take 1 down and pass the bottle around.

1 beer bottles on the wall

1 beer bottles . Take 1 down and pass the bottle around.

0 bottles of beer on the wall.

4 0
2 years ago
1. What is the global marketplace?
VladimirAG [237]

I know the answer for 1 is A

5 0
2 years ago
Read 2 more answers
Which statements describe the Sort List feature of Word? Check all that apply.
natulia [17]

Answer: It arranges text in a list alphabetically from A to Z.

Explanation: It's always easier and more systematic to arrange alphabetically. With numbers there is the possibility of infinity but not with alphabet which have a defined range.

7 0
2 years ago
Read 2 more answers
In cell M2, enter a formula using a nested IF function as follows to determine first if a student has already been elected to of
aleksley [76]

Answer:

Following are the code to this question:

code:

=IF(EXACT(I2,"Yes"),"Elected",IF(EXACT(K2,"Yes"),"Yes","No"))

Explanation:

In the given the data is not defined so we explain only  the above code, but before that, we briefly define working of if the function that can be defined as follows:

  • The If() function, is used only when one of the logical functions and its value must return the value true. or we can say it only return a true value.
  • In the above function, a column "Elected" is used that uses other column values to check this column value is equal if this condition is true it will return "yes" value.

8 0
2 years ago
Other questions:
  • To copy consecutive items, click the first item in the group, hold down _______, and click the last item
    7·2 answers
  • What are the two most important network-layer functions in a datagram network? what are the three most important network-layer f
    7·1 answer
  • A patient asks her doctor to send a copy of her records to another medical office. However, the records are not transmitted beca
    10·2 answers
  • Suppose a retailer who has no technology expertise wishes to set up an online presence for his business. He ________. a. ​can us
    6·1 answer
  • Betsy recently assumed an information security role for a hospital located in the United States. What compliance regulation appl
    6·1 answer
  • When configuring a record type, an App Builder can configure the available value of a picklist field for the page layout. Which
    9·1 answer
  • What is the name of the program file that you can enter in the Windows search or Run box to execute Event Viewer? What process i
    12·1 answer
  • In this exercise we look at memory locality properties of matrix computation. Th e following code is written in C, where element
    9·1 answer
  • Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
    7·1 answer
  • Describe the ways in which a computer-aided design (CAD) drawing makes the details of an image easier to understand.
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!