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]
2 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]2 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
Help help help help help help help help
Nataly [62]

Answer: There are many types of files because they all serve separate purposes.

Explanation: JPEG (Joint Photographic Experts Group)- images for web design, social networks, and photo portfolios.

PNG (Portable Network Graphics)- logos, websites photos, social networks (profile pictures, posts, and cover photos).

GIF (Graphics Interchange Format)- short animations for social channels

PDF (Portable Document Format)- online forms, documents, and printing services.

SVG (Scalable Vector Graphics)- Graphics on your web design, illustrated assets for your business

MP4 (Moving Picture Experts Group)- videos on your website and social media videos

6 0
2 years ago
What are expansion cards used for?​
S_A_V [24]

Answer:

an expansion card is a PCB that fits into an expansion slot on a desktop computer. An expansion card is used to give a computer additional capabilities, such as enhanced video performance via a graphics card.

Explanation:

4 0
3 years ago
Read 2 more answers
ou work as network administrator for an organization that has a Windows-based network. You want to use multiple security counter
kolezko [41]

Answer:

The three components used by defense in depth strategy are:

1) Physical controls

2) Technical controls

3) Adminstrative controls

Explanation:

Defense in depth is a strategy using multiple security measures to protect to protect the integrity of information. Today's cyberthreat are evolving and growing rapidly. Defense in depth is a solid, comprehensive approach to utilizing a combination of advanced security tools to protect critical data and block threats before they reach endpoint.

If one line of defense is compromised, additional layers of defense are in place to ensure that cracks don't slip through the cracks.

Defense in depth strategy uses three components which are:

* physical controls: are anything that physically limits or prevents access to IT systems. Examples are security guards and locked doors.

* Technical controls: are hardware or software whose purpose is to protect systems and resources. Examples are disk encryption, fingerprint readers and authentication.

* Adminstrative controls: are an organization's policies and procedures which ensures that there is proper guidance are available in regards to security and that regulations are met. Examples are hiring practices and data handling procedures.

8 0
3 years ago
Lifelong learning _____. is only important for professionals with advanced degrees can be formal or informal includes formal cla
iren2701 [21]

Answer:

can be formal or informal

Explanation:

I just took the test!

7 0
3 years ago
Which of the following is the core of an operating system that maintains the computer’s clock, starts applications, and assigns
bagirrra123 [75]
The answer is the Kernel.
In computing, the Kernel's job is to manage the I/O requests from the software on your computer and converts them into data processing instructions for the CPU (Central Processing Unit) and the rest of the electronic components of a computer.
 
4 0
3 years ago
Other questions:
  • Create a function average_temp(s) that accepts a file name s that contains temperature readings. Each line in the file contains
    15·1 answer
  • The chemical symbol H represents which of the following elements?
    9·2 answers
  • The type of database that uses fields, records, and measure as data attributes is
    7·1 answer
  • How we know that how many domain exist in window server 2012?
    14·1 answer
  • Introduction to computing systems: from bits and gates to c and beyond
    7·1 answer
  • Describe advantages and disadvantages for microprocessor controlled devices in the household.
    7·1 answer
  • Functionality testing is primarily used with ____________. firewall protection software development hardening servers server tes
    8·1 answer
  • I only put one answer and didn’t specify what it answered
    14·2 answers
  • Assert statements are a tool programmers employ to help them debug their code more efficiently.
    6·1 answer
  • I'm not sure how to solve this problem
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!