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
Ryder has discovered the power of creating and viewing multiple workbooks. ​ ​ Ryder wants to use a layout in which the workbook
777dan777 [17]

Answer:

Click the Cascade option button

Explanation:

Based on the description of what Ryder is attempting to accomplish, the next step that he needs to do would be to Click the Cascade option button. This option will cause all the windows of the currently running applications to overlap one another but at the same time show their title bars completely visible in order to let the user know their open status. Which is exactly what Ryder is attempting to make as his desired layout for the workbooks. Therefore this is the option he needs.

4 0
3 years ago
Think of the silliest problem the problem solving process could help with.
arlik [135]

Answer:

if 4 slinkies were put down a set of stairs at different times but reached the bottom at the same time. whats the difference?          

Explanation:

5 0
2 years ago
Read 2 more answers
State three positive uses of the computer in the government sector​
WINSTONCH [101]

Well Here I got 4

1. Email Functions

2. Distributing Payments

3. Record Keeping

4. Direct Mail Promotions

<em>Have A great night!</em>

<em></em>

6 0
3 years ago
How do you change the font in html?<br>&lt;______&gt;google sans"google sans font"&lt;/______&gt;
Allisa [31]
What do you want inside font colour,text,or face
7 0
3 years ago
What is the syntax of sinX????
kkurt [141]
The syntax of sinX is the script used in sinX. 
The syntax of something, whether it be Python, C++ or even sinX is just the code. 
That's why when you check the code for errors, the button says "check syntax"!
3 0
3 years ago
Other questions:
  • What are Three types of informational references
    9·2 answers
  • Rachel is on her way to an interview for the position of a project manager. She is trying to prepare for this interview by analy
    6·1 answer
  • What type of windows network model allows all the participants to be represented equally on the network with no single computer
    13·1 answer
  • 1. Describe your Microsoft word skills that need to be improved upon the most. 2. Explain the Microsoft word skills you are most
    12·1 answer
  • Then standard toolbar appears whenever you select text true or fals
    15·1 answer
  • What type of cable would you use to connect two hosts together in a back-to-back configuration using twisted pair cable?
    15·1 answer
  • Ayuda por favor.<br><br>Please help!!
    15·1 answer
  • We are sending a 30 Mbit MP3 file from a source host to a destination host. All links in the path between source and destination
    12·1 answer
  • Given three packets of size 2,500 Bytes (caution this is Bytes not bits) each are ready inside computer 1 to be transmitted onto
    14·1 answer
  • Describe from an administrator perspective what is necessary to prepare a storage device for access by a user.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!