0

In python how to write that check a list and create a new list contain existence list item.

Condition is if existence list item contain 2 "a".

13th Dec 2020, 7:10 AM
Vinay Jaiswal
Vinay Jaiswal - avatar
1 Odpowiedź
+ 1
#This is what u want a=[1,2,3,4,5] b=["a", "b",3, "c", "d",1] for i in b : if i in a : print(str(i) + " is common") #output : 3 is common 1 is common
13th Dec 2020, 7:21 AM
Ratnapal Shende
Ratnapal Shende - avatar