0
How would i create a project that, would compare two lists.
For example, list one has numbers 1-10 and list two has 4 random numbers. The result with be comparing the two lists to see what numbers they have in common. List 1 (1,2,3,4,5,6,7,8,9) list 2 (1,34,6,72) The result will be 2 since 1 and 6 appear in both lists How would I code this??
1 Antwort
+ 1
One way would be to use the built-in container type 'sets':
len(set(list1)&set(list2))