Make a function that takes two strings as input, and outputs the common characters or letters that they share. (For example, Inp | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Make a function that takes two strings as input, and outputs the common characters or letters that they share. (For example, Inp

def common(): string1 = "I love python" string2 = "I think python is cool" s1 = set(string1) s2 = set(string2) common_letters = s1 & s2 print(s1 & s2) common()

4th Oct 2021, 7:56 PM
Msawenkosi Zuma
3 Answers
+ 8
Msawenkosi Zuma , what is your question ??? if this post is just to show your code, it is the wrong place. please use playground or your personal feed. thanks for your understanding!
4th Oct 2021, 8:02 PM
Lothar
Lothar - avatar
+ 2
Dude, your function doesn't take any parameters.
4th Oct 2021, 8:05 PM
John Delvin
John Delvin - avatar
+ 1
@Lothar Make a function that takes two strings as input, and outputs the common characters or letters that they share. NB: They must not return brackets and the quotation marks, it should just return the common letters with commas separating the letters.
4th Oct 2021, 8:28 PM
Msawenkosi Zuma