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
During the troubleshooting of a pc that will not boot, it is suspected that the problem is with the ram modules. the ram modules
Damm [24]
The modules were somehow disconnected
8 0
3 years ago
Calculate the shear stress (lbf/in^2) for a given normal stress (lbf/in^2) that is applied to a material with a given cohesion (
LenaWriter [7]

MOHR-COULOMB FAILURE CRITERIA:

In 1900, MOHR-COULOMB states Theory of Rupture in Materials which defines as “A material fails due to because of a critical combination of normal and shear stress, not from maximum normal or shear stress”. Failure Envelope is approached by a linear relationship.

If you can not understand the below symbols see the attachment below

 f   f ()  

Where:      f = Shear Stress on Failure Plane  

       ´= Normal Stress on Failure Plane

 See the graph in the attachment

For calculating the shear stress, when Normal stress, cohesion and angle of internal friction are given. Use this formula:   shear stress =  f  c   tan 

Where,  

• f  is Shear Stress on Failure Plane

• c  is Cohesion

•  is Normal Total Stress on Failure Plane

•  is Friction Angle

8 0
3 years ago
Special keys that allow you to use the computer to perform specific functions
Pavel [41]

Answer:

Examples are Ctrl, Alt, Fn, Alt Gr, Shift, Caps Lock, Tab, Scroll Lock, Num lock, Esc, Windows Key, Backspace, Enter...

8 0
2 years ago
Research the design basis threat (DBT) in terms of Cybersecurity for an organization of your choice. Discuss what the Cybersecur
tiny-mole [99]

A Design Basis Threat (DBT) is known to be a characteristics of any given or potential insider and also those of external adversaries, that may try to have or gain unauthorized removal or sabotage, against a physical protection system that was set up designed and evaluated.

<h3>What are Cybersecurity objectives?</h3>

Cybersecurity aims are:

  • To protect computer system,
  • To protect networks,
  • To protect software programs from such cyber attacks.

Note that a lot of digital attacks are targeted at accessing, changing, or deleting sensitive information as well as others.

Learn more about IT from

brainly.com/question/1276995

#SPJ1

3 0
1 year ago
6.2.7: Add, Subtract, or Multiply 5 codes
Zolol [24]
Multiply duh that’s an easy one I took that freshman year dude come on.
3 0
3 years ago
Other questions:
  • A Color class has a method getColorName that returns a string corresponding to the common name for the color, e.g., yellow, blue
    11·1 answer
  • Which searching method requires that the list be sorted?
    5·1 answer
  • Hilary works at Klothes Kloset. She quickly helps the customers, and her cash drawer is always correct at the end of her shift.
    9·1 answer
  • What are the benefits of maintaining your vehicle?
    5·2 answers
  • To color the h2 heading, what tag would you use?
    6·1 answer
  • What can provides access to the only menu in office 2007​
    13·1 answer
  • 1. I write about my travel experiences on my own personal ____?
    12·1 answer
  • 4.5 code practice computer science
    5·1 answer
  • One way to use contiguous allocation of the disk and not suffer from holes is to compact the disk every time a file is removed.
    13·1 answer
  • Accessibility is the degree to which a product or service is readily available and usable by _____.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!