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
Yuri [45]
3 years ago
12

Define a function typeHistogram that takes an iterator ""it"" (representing a sequence of values of different types) and builds

a histogram showing how many values of each type appears in the next n elements in the sequence.
Computers and Technology
1 answer:
Alexeev081 [22]3 years ago
3 0

Answer:

def typeHistogram(it,n):

   d = dict()

   for i in it:

       n -=1

       if n>=0:

           if str(type(i).__name__) not in d.keys():

               d.setdefault(type(i).__name__,1)

           else:

               d[str(type(i).__name__)] += 1

       else:

           break

   return list(d.items())

it = iter([1,2,'a','b','c',4,5])

print(typeHistogram(it,7))

Explanation:

  • Create a typeHistogram function that has 2 parameters namely "it" and "n" where "it" is an iterator used to represent a sequence of values of different types while "n" is the total number of elements in the sequence.
  • Initialize an empty dictionary and loop through the iterator "it".
  • Check if n is greater than 0 and current string is not present in the dictionary, then set default type as 1 otherwise increment by 1.
  • At the end return the list of items.
  • Finally initialize the iterator and display the histogram by calling the typeHistogram.
You might be interested in
Who are The Boys? EddieVR, YourNarrator, JoshDub, Mully, and last but most certainly not least, Juicy(FruitSnacks). Green gang o
malfutka [58]

Answer:

yes or no

Explanation:

6 0
3 years ago
Description
meriva
33.33 minutes of video

3 GB already used which means you have 5 GB left, 5GB is the same as 5000 MB

So 5000 MB divided by 150 MB is 33.33 minutes of video that can be stored on the iPhone
8 0
3 years ago
An integrated file is one that includes information created in _____ Office application(s).
maria [59]

The integration of the document and records management in the organizations allows the satisfactory organization of the information, reducing the physical file and the costs while increasing the efficiency of all the business processes.

6 0
3 years ago
A storyboard is used to outline the sequence of key content on a website
juin [17]

Answer:

what else is there

Explanation:

6 0
3 years ago
4. To combine a range of cells into one large cell, you should highlight the cells and choose
Pachacha [2.7K]
Highlight the cells and choose merge cells
8 0
4 years ago
Other questions:
  • Jim has excellent oral and written communication skills. He enjoys public speaking and wants a job in which he will interact wit
    10·2 answers
  • Create your own unique Java application to read all data from the file echoing the data to standard output. After all data has b
    13·1 answer
  • Which electronic community allows you to write a message and send it to several people at the same time?
    8·2 answers
  • You need a collection to represent secret agents. Every agent has a unique codename that identifies them, and an Agent object th
    14·1 answer
  • A feature that displays in the lower right corner of a selected range with which you can analyze your data by using Excel tools
    12·2 answers
  • The file format that an application can always open a named collection of data on a storage medium such as a hard disk or usb fl
    13·1 answer
  • Which type of boot authentciation is more secure?
    13·1 answer
  • Versiones del Moodle
    10·1 answer
  • In this for loop, identify the loop control variable, the initialization statement, loop condition, the update statement, and th
    7·1 answer
  • Service-oriented architecture includes "reuse." Which of the following is a description of why a business finds it useful? Using
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!