Describe how catching exceptions can help with file errors. Write three Python examples that actually generate file errors on your 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.

Answers

Answer 1

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.

Answer 2

Answer:

Catching exceptions helps a programmer to resolve raised issues at runtime instead of deliberately closing their program.

There are a lot of types of file errors. e.g. hadware/os errors, name errors,

operation errors, data errors.

Explanation:the function try will provide a testing of your code validating if it is correct, it will continue running. and adding the function except, it will print the error.

Dealing with the error depends on what you like the program to do and how you want to identify the errors so you can work on them.


Related Questions

_______ can be used to prevent busy waiting when implementing a semaphore.
A) Spinlocks
B) Waiting queues.
C) Mutex lock.
D) Allowing the wait

Answers

Answer:

b) waiting queues

Explanation:

What is the best way to avoid data loss

Answers

Back up your data.

If you want to avoid data loss, you should back up your data.

Design an application for the Sublime Sandwich Shop. The user makes sandwich order choices from list boxes, and the application displays the price. The user can choose from three main sandwich ingredients of your choice (for example, chicken) at three different prices. The user also can choose from three different bread types (for example, rye) from a list of at least three options. Save the file as JSandwich.java.

Answers

Answer: Provided in the explanation section

Explanation:

Using Code :-

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class SandwichShop

{

String sandwichIngredients [] = {"Chicken", "Mutton", "Veg"};

String breadTypes[] = {"Bloomer", "Cob", "Plait"};

JFrame jf;

JPanel p1, p2, p3, p4, mainP;

JList ingredient, bread;

JLabel ingL, breadL, amountL;

JTextField amountT;

JButton amountB, exitB;

SandwichShop()

{

jf = new JFrame("Sandwich Shop");

p1 = new JPanel();

p2 = new JPanel();

p3 = new JPanel();

p4 = new JPanel();

mainP = new JPanel();

ingredient = new JList<String>(sandwichIngredients);

bread = new JList<String>(breadTypes);

ingL = new JLabel("Select Sandwich Ingredients");

breadL = new JLabel("Select Bread Types");

amountL = new JLabel("Amount: ");

amountT = new JTextField(5);

amountB = new JButton("Check Amount");

exitB = new JButton("Exit");

p1.add(ingL);

p1.add(ingredient);

p2.add(breadL);

p2.add(bread);

p3.add(amountL);

p3.add(amountT);

p4.add(amountB);

p4.add(exitB);

mainP.add(p1);

mainP.add(p2);

mainP.add(p3);

mainP.add(p4);

mainP.setLayout(new GridLayout(4, 1));

jf.add(mainP);

jf.setVisible(true);

jf.setSize(400, 300);

exitB.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent ae)

{

System.exit(0);

}

});

amountB.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent ae)

{

int indexIngredient = ingredient.getSelectedIndex();

int indexBread = bread.getSelectedIndex();

if(indexIngredient == 0 && indexBread == 0)

amountT.setText("100");

if(indexIngredient == 0 && indexBread == 1)

amountT.setText("120");

if(indexIngredient == 0 && indexBread == 2)

amountT.setText("160");

if(indexIngredient == 1 && indexBread == 0)

amountT.setText("190");

if(indexIngredient == 1 && indexBread == 1)

amountT.setText("205");

if(indexIngredient == 1 && indexBread == 2)

amountT.setText("210");

if(indexIngredient == 2 && indexBread == 0)

amountT.setText("97");

if(indexIngredient == 2 && indexBread == 1)

amountT.setText("85");

if(indexIngredient == 2 && indexBread == 2)

amountT.setText("70");

}

});

}

public static void main(String[] args)

{

new SandwichShop();

}

}

a rule that states each foreign key value must match a primary key value in the other relation is called the

Answers

Answer:

Referencial Integrity Contraint

Explanation:

The referential integrity constraint states that the customer ID i.e (CustID) in the Order table must match a valid CustID in the Customer table. Most relational databases have declarative referential integrity. That is to say, when the tables are created the referential integrity constraints are set up so as to maintain the quality of information.

After reading a security bulletin, a network security manager is concerned that a malicious actor may have breached the network using the same software flaw The exploit code is publicly available and has been reported as being used against other industries in the same vertical Which of the following should the network security manager consult FIRST to determine a priority list for forensic review?

Answers

Answer:

C

Explanation:

According to the text, the three IT trends that are having the greatest impact on the IT environment are:

Answers

Answer:

B. GRID COMPUTING , ON - DEMAND COMPUTING AND REAL TIME COMPUTING

Explanation:

Grid computing, on-demand computing and real time computing are currently the most impactful information technology processes. The Grid computing from example entails distributed computing whereby computing resources are distributed across different systems for a computing task. This is seen in server systems where a super virtual computer composed of a network of computers are connected to share resources and perform large tasks. This form of computing has majorly affected and improved complex computing tasks today.

On demand and real time computing are also other notable trends in IT with real time computing bringing the power of live and direct coverage of information to our screens and on demand making it possible for the average user to access computing resources as needed such as in the services of cloud computing providers

Timeliness is an important goal of any access control monitoring system.
A. True
B. False

Answers

The answer for this question is true

list five application of personal computers. is there a limit to the application of computers? Do you envision any radically different and exciting application in the near future? if so, what?

Answers

Answer:

Word processing,

Book keeping,

Digital image editing,

Creating/writing music,

Graphics design,

Gaming,

Coding,

Mapping.

Workspace How do the following technologies help you in your quest to become a digital citizen: kiosks, enterprise computing, natural language processing, robotics, and virtual reality?

Answers

Answer:

1) A kiosk are small platforms that can be used for obtaining information and programming relate to entertainment, transportation, commerce, applications, and other areas. A kiosk is located in busy business areas. With Kiosks, one is able to get answers to important information such as service locations.

2) Enterprise computing is the use of information technologies and computing in organizational setting. Enterprise computing provides improved data security

3) Natural language processing is the artificial intelligence concept that deals with the interaction between man and computer by use of natural language. With natural language processing, it is possible to interact with artificial intelligence application in the same manner we interact with a real person

4) Robotics is concerned with the design construction, and operation of robots. It involves the collaboration of computer science and engineering fields. Robotics provide 24 hours assistance including in inhuman conditions such as low oxygen

5) Virtual Reality (VR) is the creation of easily believable simulation of real life by means of computer technology. With virtual reality, one is able to practice practical  trade skills in their living room

Explanation:

I What are the three major types of equity accounts? The three major types of equity accounts are investments, ________________ , and retained earnings.

Answers

Answer:

Equity accounts include common stock, paid-in capital, and retained earnings. The type and captions used for equity accounts are dependent on the type of entity.

propose and implement a test for autocorrelated error terms. What is the name of the test, and are OLS errors autocorrelated from the test

Answers

Answer:

This value of k is the time gap being considered and is called the lag. These relationships are being absorbed into the error term of our multiple linear , If we suspect first-order auto-correlation with the errors, then a formal test does exist regarding the parameter .  A simple linear regression analysis was implemented.

function of internet security​

Answers

Answer:

Explanation:

Hola friend!!!!!

The job of internet security is implement rules and measures to prevent internet attacks. It also protects from fraud, viruses etc...

Hope this helps

plz mark as brainliest!!!!!

Which of the following is a technology designed for use in manufacturing?

A) electronic monitoring bracelets

B) machine-to-machine (M2M) communications

C) bring your own device (BYOD)

D) web analytics

Answers

Answer:

B) machine-to-machine (M2M) communications

Explanation:

Manufacturing technology refers to the technological advancement that enables the production of the tools that further helps in the manufacturing of the other goods. The quality, quantity, and production are enhanced with these manufacturing technologies. Machine-to-machine communications are designed for manufacturing technologies. In this technology, the information and data can be easily transferred from one device to another either by the help of wires or without wires.

The technology designed for use in manufacturing among the options listed is machine-to-machine (M2M) communications.

Machine-to-machine (M2M) communications involve the exchange of data or information between devices or machines without human intervention.

In the context of manufacturing, M2M technology can be used to connect and communicate between various machines, equipment, sensors, and systems involved in the manufacturing process.

This allows for automation, real-time monitoring, data collection, and coordination, ultimately improving efficiency and productivity in manufacturing operations.

To learn more on Technology click:

https://brainly.com/question/15059972

#SPJ6

Which IDS component is essentially the same as a sniffer in that it runs in conjunction with a network card in promiscuous mode? A. Console B. Sensor C. Agent D. Network tap

Answers

Answer:

D. Network tap

Explanation:

A network tap is a hardware device that provides a way to access the data flow across a computer network.

A sniffer is either hardware or software that provides a way to access the data flow across a computer network.

Hence, these two IDS components are very similar.

Cheers.

A network tap is the same as a sniffer in that it runs in conjunction with a network card in promiscuous mode. Therefore, option D is correct.

What is network tap?

A network tap can be described as a system that monitors events on a local network. A tap is a dedicated hardware device, which offers a way to access the data flowing across a network.

The network tap has three ports which are an A port, a B port, and a monitor port. A tap inserted between A and B passes all traffic via unimpeded in real-time, but copies that same data to its monitor port, enabling a third party.

Network taps are generally used for network intrusion detection systems, network probes, packet sniffers, RMON probes, and other monitoring and collection devices and software that need access to a network segment.

Taps are utilized in security applications because they are non-obtrusive, are not detectable on the network, and will pass through or bypass traffic even if the tap stops working.

Learn more about Network tap, here:

https://brainly.com/question/13025421

#SPJ2

What is an efficiency target? Give an example of setting an efficiency target

Answers

Answer:

Goals help provide our everyday lives with structure, and operate similarly at the institutional level, offering organizations a low cost method of encouraging motivation, communication and accountability. In short, goals help organizations to achieve a variety of ends—including the reduction of energy waste.

Energy efficiency improvement goals, also known as energy efficiency targets, are intended reductions in energy over a specified time frame that have been defined in a SMART manner. Targets are useful because they can encourage decision makers to improve the use of energy in their communities and operations. Moreover, energy efficiency targets can have short or long term timeframes and can be implemented on various scales, ranging from the national level down to individual buildings. Cities should explore both mandatory public sector targets and voluntary private sector targets to forge energy-efficient communities.

Main Difference between Excel and word application
programs​

Answers

Answer:

See explanation

Explanation:

Word documents are mainly for typing papers and documents. This is useful for writing a report or making a book.

Excel is for writing spreadsheets and doing math equations within the program. This is useful for having budget calculators and math equations.

Hope this helped!

The following are a set of named spreadsheets with the indicated column headings. Use these spreadsheets to answer exercises 1.30 through 1.32.
A. Name of Spreadsheet: EQUIPMENT Column Headings: (Number; Description, AcquisitionDate, AcquisitionPrice)
B. Name of Spreadsheet: COMPANY Columns Headings: (Name, IndustrvCode, Gross Sales, OfficerName, OfficerTitle)
C. Name of Spreadsheet: COMPANY Columns Headings: (Name, IndustrvCode, Gross Sales, NameOfPresident)
D. Name of Spreadsheet: COMPUTER Columns Headings: (SerialNumber, Make, Model, DiskTpe, DiskCapacityj
E. Name of Spreadsheet: PERSON Columns Headings: (Name, DateOfHire, DeptName. DeptManager, ProjectlD, NumHours, ProjecthManager)

Answers

Answer:

There are five work sheets in this excel file, they are equipment, company, company, person and computer. Excel worksheets are made up of cells, with the columns labelled alphabetically and the rows numbered.

Explanation:

The columns of a worksheet is called a field while row are called records. They are used to locate a cell in the worksheet. There are so many statistical, mathematical and engineering functions in excel. It is used to display the analysis of data.

What is the purpose of a Peer-to-Peer architecture? Describe the two methods we learned for finding the peer with a desired resource.

Answers

Answer:

peer to peer connections in a network prevents drop-down of connection when a cable fails

Explanation:

A peer to peer computer network is a connection is a network between computers that connects one device to every other device in the network. A computer is connected to its neighbors and to another computer physically with an ethernet cable.

When a cable is disconnected, the computer can still communicate with other computers in the network, preventing network drop-down and continuity.

"A loosely coupled group of volunteer programmers that contribute code to develop and maintain software are called:"

Answers

Answer:

Open Source Community

Explanation:

is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticat

Answers

Answer:

The right answer will be "Cross-Site Request Forgery (CSRF)".

Explanation:

CSRF would be an attack that causes an endpoint consumer to perform inappropriate activities throughout a website interface where they're already authenticated. These attacks only threaten state-switching requests, never data manipulation because the intruder requires no means of knowing the answer to the demand fabricated.

If two classes combine some private data members and provides public member functions to access and manipulate those data members. Where is abstraction used?a. Using private access specifier for data membersb. Using class concept with both data members and member functionsc. Using public member functions to access and manipulate the data membersd. Data is not sufficient to decide what is being used

Answers

Answer:

c. Using public member functions to access and manipulate the data members

Explanation:

In object oriented programming, abstraction is used in order to lessen the complexity and hiding non essential details about how a program is actually working in the background. In order to achieve abstraction, classes are defined in such a way that the data members are hidden and the member functions form public interface. The public member functions here are used to access and manipulate these hidden or private data members. So the use of public member functions shows the abstraction here. These members functions are public so they can be directly accessed and the hidden or private data members can be accessed indirectly with the help of these member functions. So internal details of the classes and its data members are hidden from the outside world. Thus abstraction used here ensures security of data members of two classes and protects them from any accidental alterations by other parts of program.

Dragging a mouse over text is called ........and ........​

Answers

Answer:

Explanation:

hola friend!!!!

The answer is dragging and dropping

Hope this helps

plz mark as brainliest !!!!!!!!

Comments are used to write pseudocode outlines. How do you indicate that a line is a comment? You start the line with a _________

Answers

Answer:

#

Explanation:

A more common way to plan a program is with pseudocode, an outline composed of comments. Comments are indicated by a pound sign (#) at the beginning of the line.

Depending on the programming language, there are several ways we can comments our statements or codes that are not needed in our programmes

In Kotlin and Java Languages we can us the double slash "//" symbol to express single line comment

Example

//This is a comments

We can also us the "/***/" to express multi line comments

Example

/**This is a comment

also*/

Hence we have the

Inline Comments Multiline Comments

For more information on comments in programming language kindly visit

https://brainly.com/question/15068446

Write a program using integers user_num and x as input, and output user_num divided by x three times. Ex: If the input is: 2000 2 Then the output is: 1000 500 250

Answers

Answer:

Soory! I can't tell please tell clearly

Answer:

user_num = int(input("Number: "))

x = int(input("x: "))

for i in range(1,4):

    user_num = user_num/x

    print(user_num," ")

Explanation:

The use of encryption and authentication protocols is the standard method of countering attempts to alter or insert transmissions.a) trueb) false

Answers

Answer:

a) true.

Explanation:

Encryption is a form of cryptography and typically involves the process of converting or encoding informations in plaintext into a code, known as a ciphertext. Once, an information or data has been encrypted it can only be accessed and deciphered by an authorized user.

Some examples of encryption algorithms are 3DES, AES, RC4, RC5, and RSA.

On the other hand, authentication can be defined as the process of verifying the identity of an individual or electronic device. Authentication work based on the principle of matching an incoming request from a user or electronic device to a set of uniquely defined credentials.

Basically, authentication ensures a user is truly who he or she claims to be, as well as confirm that an electronic device is valid through the process of verification.

Digital certificates, smart cards, picture passwords, and biometrics are used to perform an authentication.

Hence, in cybersecurity the use of encryption and authentication protocols is the standard method of countering attempts to alter or insert transmissions.

Which quality of service (QoS) mechanism provided by the network does real-time transport protocol (RTP) rely on to guarantee a certain QoS for the data streams it carries

Answers

Answer:

The real-time transport protocol (RTP) carries the audio and video data for streaming and uses the real-time control Protocol to analyse the quality of service and synchronisation. The RTP uses the user datagram protocol ( UDP) to transmit media data and has a recommended Voice over IP configuration.

Explanation:

RTP is a network protocol used alongside RTCP to transmit video and audio file over IP networks and to synchronise and maintain its quality of service.

The instructions tha tell the computer how to carry out the processing tasks are refered to as........

Answers

Answer:

Code

Explanation:

Code are basically instructions in the computers language to tell the computer “what to do.” If you want to, say, open and edit a file, you’d tell the computer to do that by:

Opening the file

Finding where to edit

Adding the line of your choice

Hope this helped!

Study the sentence below. Highlighting a word, phrase, or a sentence is used to emphasize or CALL ATTENTION to the text Which word is highlighted?​

Answers

Answer: Emphasize

Explanation:

Answer: Emphasize

Explanation: gl hope this helps

Write a program that contains the following two methods: /** Convert from feet to meters */ public static double footToMeter (double foot) /** Convert from meters to feet */ public static double meterToFoot (double meter) The formula for the conversion is : meter

Answers

Complete Question:

Write a program that contains the following two methods:

/** Convert from feet to meters */

public static double footToMeter(double foot)

/** Convert from meters to feet */

public static double meterToFoot(double meter)

The formula for the conversion is: meter = 0.305 * foot and foot = 3.279 * meter Write a test program that invokes these methods. PLEASE WRITE IN JAVA.

Answer:

//Declare the class

public class Converter{

   

    //method footToMeter that receives the foot as parameter

    public static double footToMeter(double foot){

        //declare a double variable called meter,

        //to hold the result of the conversion

        double meter;

       

        //using the given formula, conver the foot to meter and

        //store the result in the meter variable

        meter = 0.305 * foot;

       

        //return the result stored in meter

        return meter;

    }

   

   

    //method meterToFoot that receives the meter as parameter

    public static double meterToFoot(double meter){

        //declare a double variable called foot,

        //to hold the result of the conversion

        double foot;

       

        //using the given formula, convert the meter to foot and

        //store the result in the foot variable.

        foot = 3.279 * meter;

       

        //return the result stored in foot.

        return foot;

    }

   

   

    //Test program to invoke those methods

    public static void main(String []args){

           

           //Convert 120 feet to meter

           System.out.println("120 feet to meter is " + footToMeter(120));

           

           //Convert 36 meters to foot

           System.out.println("36 meters to feet is " + meterToFoot(36));

    }

   

   

}  //End of class declaration

Sample Output:

120 feet to meter is 36.6

36 meters to feet is 118.044

Explanation:

The above code has been written in Java and it contains comments explaining each line of the code. Please go through the comments.

There is also a sample output from the run of the code.

An screenshot containing the program and the output has also been attached to this response.

Which of these statements is true?
A. Cognitive systems can only translate small volumes of audio data into their literal text translations at massive speeds
B. Cognitive systems can only process neatly organized structured data
C. Cognitive systems can derive mathematically precise answers following a rigid decision tree approach
D. Cognitive systems can learn from their successes and failures

Answers

Answer:

D. Cognitive systems can learn from their successes and failures

Explanation:

Cognitive System is a term used in Computer Science to describe an advanced computer in which it was built to think and behave like humans. In other words, it is a form of artificial intelligence, which has the ability to assess activities before taking them.

Hence, in this case, the right answer is "Cognitive systems can learn from their successes and failures," because this is an attribute of human being, in which cognitive computing is created to behave or have human reasoning.

Other Questions
Objects fall near the surface of the earth with a constant downward acceleration of 10 m/s2 . At a certain instant an object is moving upward at 20 m/s. What is its velocity 2 sec later? among the three organs of government legislature is most important why how many states are there and is there a certain state that has ice Which is different? Find "both" answers. Write and solve an equation to determine how many degrees the temperature T fell. The temperature at 5 P.M. Is 20F. The temperature at 10 P.M. Is 5F. A graduated cylinder is filled to an initial volume of 20ml. A ball is dropped into the graduated cylinder. The final volume of the graduated cylinder is 29 ml. If the has a mass of 27 g. What is the density of the ball? Sarah is expanding her landscaping business. She currently has three regions in which she provides landscaping services, and intends to increase that by two regions every month. Each region begins with eight clients, and she intends to increase the number of clients by three every month. The estimate for the total number of clients is given by the expression below, where x is the number of months after Sarah begins the expansion. What is an interaction?(1 point) the analysis of how people, things, events, or ideas affect each other the effect one person, thing, event, or idea has on another the difference among people, things, events, and ideas similarities among people, things, events, or ideas Which acronym can help you remember the components of a body paragraph? A. QEC B. REDI C. HELP 5(x^3)^2(-2x^4)^-3Simplify and write with positive exponentsP.s that isnt minus 3, it is exponent -3 Make p the subject of the formulay = 3p2 - 4 how long should your thesis statement be Approximately how long will it take light to travel to 1.7 AU in minutes? Use 3 108 m/s for the speed of light. unanswered William started a game with twice as many poker chips as Victoria. William gave 20 of his chips to Victoria, and he still had 10 more chips than her. How many chips did William start with? If you wanted to securely transfer files from your local machine to a web server, what file transfer protocol could you use? When you open as many links as you want, and still stay in the same browser window instead of cluttering your screen with multiple windows, it's called----- a Tabbed browsing b Same browsing c Decluttering browsing d Multiple browsing 3) Choose the prime factorization of 15.O 11,4O 5,5,5O 3,5O 2, 2, 1105.10 Explain the general steps to adding any two polynomials. Sam saw something terrifying. His muscles tensed, he began breathing more rapidly, and he began to sweat. Having taken introductory psychology, Sam knew that the ________________ division of his __________ nervous system had been activated. 0 points sympathetic; limbic parasympathetic, autonomic somatic, peripheral central, sympathetic what are dense rational numbers