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.
Answer:
The answer to this question is given below in the explanation section.
Explanation:
The selection sort algorithm step started from 0, and continue till the sorting is done.
The correct answer after selection sort algorithm at the 4th step is:D
[0,1,2,4,8,10].
The complete detail of step by step execution is shown in the attached document file.
One gallon is 3.7854 liter so 4 liters are more than one gallon.
Yes insurance can help you
Answer:
Assuming this is Python, I would do something like the following:
Explanation:
hourWage= float(input ("What is your hourly wage?: "))
regularHours= float(input ("How many regular hours did you work this week?: "))
overtimeHours= float(input ("How many overtime hours did you have this week?: "))
overtimeWage= (1.5*hourWage)
totalWeeklyPay= (hourWage*regularHours)+(overtimeHours*overtimeWage)
print= ("Your total weekly pay is: " ,totalWeeklyPay)
I hope this works!