Can also make it a string,and then count.
As string
As string
count()
method counts occurrences of substring,and list count()
method counts whole values in list.>>> lst = [1, 4, 9, 16, 25, 36, 49, 64, 81] >>> s = ''.join(str(i) for i in lst) >>> s '149162536496481' >>> s.count('1') 3 >>> help(s.count) Help on method_descriptor: count(...) S.count(sub[, start[, end]]) -> int Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.