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
MariettaO [177]
2 years ago
8

In python please:

Computers and Technology
1 answer:
Vikki [24]2 years ago
3 0

Answer:

"

if 'marsupial' in dictionary:

   del dictionary['marsupial']

else:

   print("The key marsupial is not in the dictionary")

"

Explanation:

So you can use the keyword "in" to check if a certain key exists.

So the following code:

"

if key in object:

   # some code

"

will only run if the value of "key" is a key in the object dictionary.

So using this, we can check if the string "marsupial' exists in the dictionary.

"

if 'marsupial' in dictionary:

   # code

"

Since you never gave the variable name for the variable that references a dictionary, I'm just going to use the variable name "dictionary"

Anyways, to delete a key, there are two methods.

"

del dictionary[key]

dictionary.pop(key)

"

Both will raise the error "KeyError" if the key doesn't exist in the dictionary, although there is method with pop that causes an error to not be raised, but that isn[t necessary in this case, since you're using the if statement to check if it's in the dictionary first.

So I'll just use del dictionary[key] method here

"

if 'marsupial' in dictionary:

   del dictionary['marsupial']

else:

   print("The key marsupial is not in the dictionary")

"

The last part which I just added in the code is just an else statement which will only run if the key 'marsupial' is not in the dictionary.

You might be interested in
World pade is world processing software true or false​
Evgesh-ka [11]

Answer:

yes

Explanation:

5 0
2 years ago
Big Data _______________. Relies on the use of unstructured data imposes a structure on data when it is captured relies on the u
kifflom [539]

Answer:

captures data in whatever format it naturally exists

Explanation:

quizletBig Data _______________. Relies on the use of unstructured data imposes a structure on data when it is captured relies on the use of structured data captures data in whatever format it naturally exists

4 0
2 years ago
What is a quasi vpn?
Natasha2012 [34]

Answer:

i don't think there is such thing as a quasi vpn

Explanation:

6 0
3 years ago
An investigator responsible for tracking e-mail communication would begin by locating what
Ainat [17]
Email headers contains information about email
6 0
2 years ago
How far is florida from oklahoma?
leonid [27]
Florida is 1,344.8 miles from oklahoma
7 0
3 years ago
Read 2 more answers
Other questions:
  • Software that manages and supports the resources of a computer is known as?
    10·1 answer
  • What inventor patented the first American movie projector?
    14·2 answers
  • Which of the following consists of electronic components that store instructions?
    10·1 answer
  • A collection of information stored in an electronic format that can be searched by a computer.
    14·1 answer
  • Given positive integer numinsects, write a while loop that prints that number doubled without reaching 100. follow each number w
    10·1 answer
  • What is output? Select all that apply.
    15·1 answer
  • A sequence of repetitive operations performed to evaluate the ability of a PC to operate at peak efficiency for a defined time p
    15·1 answer
  • Jackie created a poster for a rock band. Which file format will best preserve the graphics? 20PTS​
    14·2 answers
  • Write the name of main ore of silver.Write any two application of sliver​
    14·1 answer
  • These 2 questions PLEASEEE (:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!