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
Barricades, vertical panels, drums, and cones in construction zones are known as__________ devices.
Whitepunk [10]
<span>Barricades, vertical panels, drums, and cones in construction zones are known as channelizing devices. They a</span>re used in construction and maintenance work areas <span> to notify drivers or passengers of unusual or potentially dangerous conditions in or near work areas.
</span>A barricade is a portable or fixed device having from one to three rails with appropriate markings. It is used to control traffic by closing, restricting, or delineating all or a portion of the right-of-way.<span>Drums are most commonly used to channelize or delineate traffic flow but may also be used singly or in groups to mark specific locations.</span>
6 0
3 years ago
1. Data in a smart card can be erased
Ostrovityanka [42]

Answer:

false

true

false

true

true

5 0
3 years ago
Read 2 more answers
How do you find binary?
trasher [3.6K]

Answer:

To convert integer to binary, start with the integer in question and divide it by 2 keeping notice of the quotient and the remainder. Continue dividing the quotient by 2 until you get a quotient of zero. Then just write out the remainders in the reverse order.

Explanation:

3 0
2 years ago
When my phone powers on does it take away 1 percent of battery?
ryzh [129]

Answer:

No, battery is based on your phone activity. Simply turning your phone on will not take away battery percentage.

7 0
2 years ago
Read 2 more answers
Windows server 2012 r2 supports two types of folder shares. what are those two types?
larisa [96]
<span>Windows server 2012 r2 supports the following two types of folder shares: </span>Network File System and Server Message Blocks. Correct answer: D
Network File System<span> (</span>NFS) is a distributed file system protocol for <span>storing and updating files on a remote computer. </span>
The Server Message Block<span> (SMB) Protocol is a </span>network file sharing protocol.
7 0
3 years ago
Other questions:
  • The term “frivolous” implies that the author
    9·1 answer
  • Write a program that uses for loops to perform the following steps: Prompt the user to input two integers: firstNum and secondNu
    15·1 answer
  • An information security ________ is a specification of a model to be followed during the design, selection, and initial and ongo
    11·2 answers
  • How do you think advances in processors affect corporations that discover the computers they purchased just a couple of years ag
    10·1 answer
  • In addition to telling you which programs are currently running, what other information does the task bar display
    10·1 answer
  • Write a method that takes a Regular Polygon as a parameter, sets its number of sides to a random integer between 10 and 20 inclu
    10·1 answer
  • Rachel wants to minimize project risks. Arrange the steps in an order that will correctly help Rachel and her team to minimize p
    13·2 answers
  • Because travel distance, cost of living, and other factors vary among the three regions, the annual cost of having a salesperson
    14·1 answer
  • ¿Cuáles aspectos serían los que más incidirían para que no se pudiera cumplir con el principio de imparcialidad en una auditoría
    11·1 answer
  • Which two extensions in scratch are correctly matched to their accessibility goals
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!