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
masha68 [24]
2 years ago
6

Which would you use to get the number of elements in a dictionary?

Computers and Technology
1 answer:
Vikentia [17]2 years ago
8 0

The function use to get the number of element in a dictionary is len.

<h3>What is a dictionary?</h3>

Dictionaries are used to store data values in key-value pairs. Dictionary are ordered.

Dictionary in python are express as follows:

my_dict = {"name": "Michael", "age": 28, "school": "Oxford"}

Therefore, the length of the element of the dictionary can be gotten using the len() function.

Hence,

print(len(my_dict)) will give you the length of the element.

learn more on dictionary here: brainly.com/question/14120893

#SPJ11

You might be interested in
How to format each dictionary item as a text string in the input file. How to covert each input string into a dictionary item. H
Jet001 [13]

Answer:

- To get the items of a dictionary and print them as a string, use the items() method to unpack the keys and values in a for and print or write them into a file.

for key, value in mydict.items():

   print(f"{key}, {value}")

- To convert string from user input into dictionary;

   mystring = input().split(" ")  #assuming the words are separated by a space.

   from word in mystring:

       mydict[word] = mydict.get(word, 0) + 1

This would use the words in the string as the keys of the dictionary and the count of each word as the respective values.

Explanation:

A dictionary is a data structure in python used to store data in key-value pairs. The items are enclosed in curly braces and can be accessed with the key in dot or bracket notation.

7 0
3 years ago
Let S be an NP-complete problem and Q and R be two other problems not known to be in NP. Q is polynomial time reducible to S and
levacccp [35]

Answer:

B. R is NP Hard

Explanation:

Given:

S is an NP complete problem

Q is not known to be in NP

R is not known to be in NP

Q is polynomial times reducible to S

S is polynomial times reducible to R  

Solution:

NP complete problem has to be in both NP and NP-hard. A problem is NP hard if all problems in NP are polynomial time reducible to it.

Option B is correct because as given in the question S is an NP complete problem and S is polynomial times reducible to R.

Option A is not correct because R is not known to be in NP

Option C is not correct because Q is also not known to be in NP

Option D is not correct because Q because no NP-complete problem is polynomial time reducible to Q.

5 0
3 years ago
Master controller for all activities that take place within a computer; primary purpose is to help the computer system monitor i
Ray Of Light [21]

Answer:

Operating System

Explanation:

Master controller for all activities that take place within a computer; primary purpose is to help the computer system monitor itself in order to function efficiently

8 0
3 years ago
Read 2 more answers
A) Describe how an attacker can obtain the one-time pad that is used to encrypt a message, given both the message and the cipher
erastovalidia [21]

Answer:

(a)

Assuming the one-time pad P is used to XOR the message M to get ciphertext C, the following holds:

M ⊕ P = C

P = C ⊕ M

this is a basic property of how XOR works.

(b)

P = M1 ⊕ C1

then M2 = C2 ⊕ P

(c)

The attacker can make assumptions about the message (e.g., presence of certain words and spaces) and then calculate which pad would be needed to get them in the ciphertexts. He then has two ciphertexts that should yield valid content, making it much more easy to guess the pad.

Explanation:

5 0
3 years ago
How many bits must be “flipped” (i.e., changed from 0 to 1 or from 1 to 0) in order to capitalize a lowercase ‘a’ that’s represe
castortr0y [4]
Only one.
00100001 is 'A'
01100001 is 'a'
4 0
3 years ago
Other questions:
  • A search engine is a way to
    15·2 answers
  • Write an application program that creates and prints a random phone number of the form XXX-XXX-XXXX. Include the dashes in the o
    5·1 answer
  • Vanessa and Marie are best friends. Vanessa tells Marie that one of their classmates has been posting nasty comments about Vanes
    10·2 answers
  • The picture that graphically represents the items you use in windows is called a/an
    13·1 answer
  • Once the term of copyright has expired,a work
    15·1 answer
  • Why operating system is important software for a computer give five reasons
    13·1 answer
  • In cell B20, enter a function to calculate the average attendance for 2018
    11·1 answer
  • Please I have been having a problem with this assignment of mine but I have not gotten an answer. Idiot know if anybody could be
    15·1 answer
  • Spam is _____.
    6·2 answers
  • 2. The Warren Commission investigated the assassination of President _______________________ in 1964.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!