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
Which types of computers are used by large businesses
aniked [119]

answer:

Mainframe computers are used by large companies and organisations to perform critical tasks that involve bulk data processing like transaction processing, census information, statistical data and so on. They consist of extensive input and output facilities, are very stable and dependable and handle millions of transactions every day

Explanation:

4 0
3 years ago
These commands are established by combatant commanders when authorized by the Secretary of Defense through the Chairman of the J
Romashka-Z-Leto [24]

Answer:

b. Combatant Command

Explanation:

The Combatant commands are commands which are primarily authorized by the Secretary of Defense with approval from the President. They are then executed by the Combatant Commanders (CCDR's), who receive information from the higher authorities through the Chairman of the Joint Chiefs of Staff. The combatant commanders head the combatant commands and are usually four-star Generals. The combatant commands have a broad and continuing purpose.

They ensure synergy for the command and control of the United States military forces. They are formed on the basis of geography or function. The United States Defense Department has eleven (11) combatant commands which serve either a geographic or functional purpose.

8 0
3 years ago
Were Al Zink’s actions that of someone trying to be an invisible Sponsor
AlexFokin [52]
Al Zink actions differentiate him as trying to take an invisible role as a project sponsor. That is, Al Zink does not do his chosen role and accountability as the lead project sponsor. Though, in dissimilar occasions, Al Zink is seen to evade making a serious choice regarding the development of the project. Consequently, as a project sponsor, it is his accountability to deliver clear steps in increasing the project, recover every step of project development and balance the start of the project. 
7 0
3 years ago
The default _____ color is set when you type text.
Elenna [48]
The default hyperlink color is automatically set when you type
5 0
2 years ago
Suppose that the format for license plates in a certain state is two letters followed by four numbers. (a) How many different pl
Ymorist [56]

Answer:

(a) 6,760,000 plates

(b) 3,407,040 plates

(c) 6,084,000 plates

Explanation:

The very first thing to note about this question is the number of characters involved in the license plate format (6 characters in this case; 2 letters and 4 numbers). The letters come first and then the numbers follow.

There are a total of 26 possible letters (A-Z) and 10 possible numbers (0 - 9) that can be chosen. We can then proceed to the first question;

(a) Here, the total number of possible plates is to be determined. This is done as follows:

Character 1 (Letter): There are 26 possible letters

Character 2 (Letter): There are 26 possible letters

Character 3 (number): There are 10 possible numbers

Character 4 (number): There are 10 possible numbers

Character 5 (number): There are 10 possible numbers

Character 6 (number): There are 10 possible numbers

So, total number of different plates will be obtained by multiplying all the possibilities: 26 × 26 × 10 × 10 × 10 × 10 = 6,760,000 plates

(b) This second part puts a constraint on the usage of the numbers, unlike the question (a), where there was no constraint at all.

Since there is no constraint on the letters, we can write that:

Character 1 (Letter): There are 26 possible letters

Character 2 (Letter): There are 26 possible letters

For the first number as well, we can write:

Character 3 (number): There are 10 possible numbers

However, for the remaining characters, the possibilities will continually reduce by a value of 1, since we can not use a number that has been used before. So,

Character 4 (number): There are 9 possible numbers

Character 5 (number): There are 8 possible numbers

Character 6 (number): There are 7 possible numbers

So, total number of different plates will be: 26 × 26 × 10 × 9 × 8 × 7 = 3,407,040 plates

(c) Here, repetitions are allowed as in questions (a), but there can not be four zeros. This implies that the maximum number of zeros in any plate will be three. Thus, there will be maximum possibilities on all characters until the last one which will be constrained.

Character 1 (Letter): There are 26 possible letters

Character 2 (Letter): There are 26 possible letters

Character 3 (number): There are 10 possible numbers

Character 4 (number): There are 10 possible numbers

Character 5 (number): There are 10 possible numbers

Character 6 (number): There are 9 possible numbers

Total number of plates will therefore be: 26 × 26 × 10 × 10 × 10 × 9 = 6,084,000 plates.

7 0
3 years ago
Other questions:
  • Enzo formed a study group for an upcoming geography test. To start off each session, they go over past notes and look at maps. T
    14·1 answer
  • Who were called “freedmen” during the reconstruction period?
    15·2 answers
  • What could be one rule to help your friend to blog safely
    6·2 answers
  • EXCEL 2016:
    8·2 answers
  • What is modularity? Help asap
    9·1 answer
  • Why does a computer need memory​
    15·2 answers
  • If you were practicing keyboarding and the exercise contained the letters j, k, l, m, n, and b, what section of the
    14·1 answer
  • How to use 2 tabs at once on my Lenovo yoga book?​
    9·1 answer
  • What operating system do most users use?
    13·1 answer
  • Which quality should an experiment have to be replicable and valid? O clearly detailed results O a well-cited research paper O s
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!