d somthing like
list = [1,5,56,2] listwin = [3,85,1,5]
i want check if of list numbers exist in listwin , wich numbers exist in each other ! !!!
you can use list comprehension find common elements. also, don't use built-in name list
variable name.
in [1]: list1 = [1,5,56,2] # first list in [2]: list2 = [3,85,1,5] # second list in [3]: common_elements = [x x in list1 if x in list2] in [4]: common_elements # common elements in 2 lists out[4]: [1, 5]
Comments
Post a Comment