DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR TYPESCRIPT
How to compare two lists and return the number of times they match at each index in python
>>>
list1
=
[
1
,
1
,
0
,
1
,
0
,
1
]
>>>
list2
=
[
0
,
1
,
0
,
1
,
1
,
0
]
>>>
sum
(
a
==
b
for
a
,
b
in
zip
(
list1
,
list2
)
)
3
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#How
#compare
#lists
#return
#number
#times
#match
#index
#python
ADD COMMENT
Topic
COMMENT
Name
9+9 =
Submit