0

Python

Finding common elements in them

1st Dec 2020, 4:03 PM
Ajith
Ajith - avatar
4 Answers
+ 10
Ajith , you can use print statement like this, it uses unpack operator "*" print(*set(list_1) & set(list_2))
1st Dec 2020, 4:17 PM
Lothar
Lothar - avatar
0
list_1=input().split() list_2=input().split() print(set(list_1) & set(list_2)) For example list_1= a b c d list_2=c d e f Output is {'c' ,'d'} I want in this format output c d
1st Dec 2020, 4:06 PM
Ajith
Ajith - avatar
0
What changes should b made help me wizards
1st Dec 2020, 4:06 PM
Ajith
Ajith - avatar
0
Thank you lothar
1st Dec 2020, 4:21 PM
Ajith
Ajith - avatar