Finding the frequency of each element in a Tuple in Python
Code to find the frequency of each element in a Tuple in Python: T=(1,2,3,1,1,5,5,6,1,5,5,6) print("Tuple=",T) for i in range(0,len(T)): if T[i] not in T[:i]: c=T[i:].count(T[i]) print(T[i],"frequency=",c)
No comments:
Post a Comment