Ask Your Question

Revision history [back]

You can count the number of occurrences of the object [1,2] in the list X as follows:

sage: X.count([1,2])
2

And you can have the length of X as follows:

sage: len(X)
5

I am pretty sure you will be able to deduce the frequency from those two informations ;)