A sample list (V) is shown below :
V = [[2, 6], [3, 10], [15], [23], [1, 8, 15, 22, 29], [14]]
For the above given list V, the function MVisit( ) should return the result as [1, 8, 15, 22, 29].
# Code
V = [[2, 6], [3, 10], [15], [23], [1, 8, 15, 22, 29], [14]]
c = 0 # count the number of visits
hv = None # the visits
for i in V:
if len(i) > c: # compares numbers of visits
c = len(i)
hv = i
print(‘Highes number of visits :’, hv)
# Output
Highes number of visits : [1, 8, 15, 22, 29]