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
True or False, A column is a horizontal arrangement for items of information.
Norma-Jean [14]

Answer:

False

Explanation:

A column is the arrangement of information vertically.

Horizontal arrangement is called row.

7 0
3 years ago
Declared inside a function and is only available within the function in which it is declared.
vitfil [10]

Answer:

2b2t

Explanation:

2b2t

3 1
3 years ago
What are the 5 general terms of the fair use rule
Andrews [41]

the purpose and character of your use.

the nature of the copyrighted work.

the amount and substantiality of the portion taken, and.

the effect of the use upon the potential market

In its most general sense, a fair use is any copying of copyrighted material done for a limited and “transformative” purpose, such as to comment upon, criticize, or parody a copyrighted work. Such uses can be done without permission from the copyright owner

the nature of the copyrighted work; the amount and substantiality of the portion used in relation to the copyrighted work as a whole; and. the effect of the use upon the potential market for or value of the copyrighted work

uwu hope dis halpz!

5 0
3 years ago
You can use a 32-bit processor to install the hyper-v role as long as it supports virtualization extensions. true or false
Ainat [17]
No, that is false. :)
3 0
4 years ago
Recently, a serious security breach occurred in your organization. An attacker was able to log in to the internal network and st
natulia [17]

Answer: Geotagging was enabled on her smartphone

Explanation:

The security weakness that is the most likely cause of the security breach is that geotagging was enabled on the vice president's smartphone.

Geotagging, occurs when geographical identification metadata are added to websites, photograph, video, etc. Geotagging can be used to get the location of particular place.

In this case, since geotagging was enabled on her smartphone, it was easy for the attacker to locate her house.

8 0
3 years ago
Other questions:
  • As a trainer for Exempla Healthcare, Tina is faced with many challenges to properly training her new hires. There are over 40 di
    15·1 answer
  • When you type into a basic search engine like Google, Bing, or Yahoo!, the sites that appear at the top or on the side of the re
    7·1 answer
  • IoT is the interconnection of what?<br> Hardware<br> Networks<br> Everyday devices<br> Cables
    10·1 answer
  • Of the measures of feasibility in the accompanying figure, ____ considers points such as "Does the proposed platform have suffic
    8·1 answer
  • Windows OS and Mac OS are examples of which type of operating systems?
    5·1 answer
  • Which phrases from the two selections MOST help the reader define the meaning of "captivity"?
    11·2 answers
  • What is an example of using the Internet of Things (IoT) to deliver innovative Cloud-based solutions to customers?
    14·1 answer
  • When proposing a plan in detail for video production phases, fundraising, and outreaching, which section will you use to make su
    14·2 answers
  • Alishia's employer has its corporate office on one side of their city, but its data
    5·1 answer
  • What does playstation network is currently undergoing maintenance?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!