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

Write 3 functions in the starter code below such that: add_to_dict(): takes a dictionary, a key, a value and adds the key,value

pair to the dictionary. If key is already in dictionary then it displays the error message: "Error. Key already exists.". Returns dictionary. remove_from_dict(): takes a dictionary and key and removes the key from the dictionary. Returns dictionary. If no such key is found in the dictionary then it prints: "No such key exists in the dictionary.". Hint: Use try-except. find_key(dictt, key): takes dictionary and key and prints value corresponding to the key from the dictionary: print("Value: ", value). If key is not found, then prints: "Key not found." Hint: Use try-except
Computers and Technology
1 answer:
shepuryov [24]3 years ago
4 0

Answer:

Required code is given below:

Explanation:

def add_to_dict(dictt, key,value):

if key in dictt.keys():

print("Error. Key already exists.")

else:

dictt[key]=value

return dictt

def remove_from_dict(dictt,key):

try:

dictt[key]

dictt.pop(key, None)

return dictt

except KeyError:

print("No such key exists in the dictionary.")

def find_key(dictt,key):

try:

value=dictt[key]

print("Value: ", value)

except KeyError:

print("Key not found.")

You might be interested in
What underlying concept is edge computing based on?
guajiro [1.7K]

Answer:

Edge computing was developed due to the exponential growth of IoT devices, which connect to the internet for either receiving information from the cloud or delivering data back to the cloud. And many IoT devices generate enormous amounts of data during the course of their operations.

Explanation:

8 0
2 years ago
Read 2 more answers
A manufacturing company has several one-off legacy information systems that cannot be migrated to a newer OS due to software com
Digiron [165]

The resiliency technique which would provide the aforementioned capabilities is: D. Full backups.

An operating system (OS) can be defined as a system software which is pre-installed on a computing device, so as to manage or control software application, computer hardware and user processes.

In this scenario, a manufacturing company cannot migrate its several one-off legacy information systems (IS) to a newer operating system (OS), due to software compatibility issues.

Resiliency can be defined as a measure of the ability of a network, server, storage system, computing system or data center, to recover quickly and continue operating when it experience adverse conditions such as:

  • Power failure.
  • Equipment failure.
  • Data loss.

In Computers and Technology, there are four (4) main resiliency technique and these include:

I. Redundancy.

II. RAID 1+5.

III. Virtual machines.

IV. Full backups.

Full backup is a resiliency technique which create backups of the systems for recovery and it allows operating system (OS) patches to be installed on computer systems.

Read more: brainly.com/question/17586013

3 0
2 years ago
public class Questions { public static void main(String[] args) { System.out.print("Here "); System.out.println("There " "Everyw
In-s [12.5K]

Answer:

The output of this code can be given as follows:

Output:

Here There Everywhere

But notin Texas

Explanation:

In the give java code a class "Questions" is defined inside this class the main method is defined in the main method we use three print function that can be described as follows:

  • In the first print function, we print the message that is "Here".
  • In the second and third print function, we use println that print data or message in the next line that is "There Everywhere" and in the next line  "But not" and "in Texas".
6 0
3 years ago
Game Informer (often abbreviated to GI) is an American-based monthly magazine featuring articles, news, strategy, and reviews of
Eddi Din [679]

Answer:

it is d i just took it

Explanation:

6 0
3 years ago
Read 2 more answers
What type of error occurs when a program is expecting an integer value and the user enters a string?
Alona [7]

The type of error that occurs when a program is expecting an integer value and the user enters a string is value error.

<h3>What are errors in program?</h3>

Errors are the problems or the faults that occur in the program.

This error makes the program behave abnormally. It usually acts contrary to  what you expect.

Example of errors includes runtime error, syntax error, compilation error, value error, logic error and many more.

Therefore, type of error occurs when a program is expecting an integer value and the user enters a string is value error.

learn more on error here: brainly.com/question/17924309

#SPJ2

5 0
2 years ago
Read 2 more answers
Other questions:
  • Can someone please help me with this question?
    12·1 answer
  • Which is an example of an input device?
    15·2 answers
  • Which option marks all modification made within a document? Review Comment Track Changes Balloons
    15·2 answers
  • Tom is the aerobics coordinator at a fitness center. He needs a more efficient way for his instructors to share information. Cla
    13·2 answers
  • In which type of market do farmers sell their produce directly to village traders in rural areas?
    14·1 answer
  • Read the excerpt from The Code Book. Other attacks include the use of viruses and Trojan horses. Eve might design a virus that i
    13·1 answer
  • If metal shims are used for alignment adjustment in the front, they adjust ________.
    5·1 answer
  • Which of the following actions can NEGATIVELY impact your credit score?
    9·1 answer
  • Write a program that will generate a personalized invitation within a text file for each guest in the guest list file using the
    15·1 answer
  • What is the function of a primary key in a table? to uniquely identify each record in the table to uniquely identify foreign key
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!