Top down program design is an approach to program design that starts with the general concept and repeatedly breaks it down into its component parts. In other words, it starts with the abstract and continually subdivides it until it reaches the specific. Consider creating the prime factorization of a number like 1540. The steps involved might look like:
1540
2 x 770
2 x 2 x 385
2 x 2 x 5 x 77
2 x 2 x 5 x 7 x 11
Top down program design works the same way. We start with the overall objective and wind up with a series of steps needed to accomplish it.
Answer:
Use font colors that work well with your background.
Select font sizes that are appropriate for your delivery method.
Fonts should be appropriate for your audience.
Limit the number of fonts you use to three or four.
Hope this helps!
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.