- 2
A program to find any 11 num in a given array
3 Respostas
+ 3
To check if the element exists, use any of the 3 methods:
> in operator (returns true if it exist)
>count function (if count is !=0, element exist)
><list>.index(element) (returns -1: element doesn't exist)
+ 1
Find count of 11s or the indices of them ?
0
you could use filter() function to get a new list with all 11's in a list/array or do it with list comprehension ;)
elevens = [v for v in thelist if v==11]
elevens = filter(lambda v: v==11, thelist)
https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/methods/built-in/filter