A computer is a device whose main function is to process large amounts of information quickly and accurately, and this procedure is done thanks to hardware and software.
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:
<u>720</u> possible PIN can be generated.
Explanation:
To calculate different number of orders of digits to create password and PIN, we calculate permutation.
Permutation is a term that means the number of methods or ways in which different numbers, alphabets, characters and objects can arranged or organized. To calculate the permutation following formula will be used:
nPr = n!/(n-r)!
there P is permutation, n is number of digits that need to be organize, r is the size of subset (Number of digits a password contains)
So in question we need to calculate
P=?
where
n= 10 (0-9 means total 10 digits)
r= 3 (PIN Consist of three digits)
So by using formula
10P3 = 10!/(10-3)!
=10!/7!
= 10x9x8x7!/7!
= 10x9x8
= 720
Answer:
I believe import math.
Do let me know if its correct.