Python Program to check Common Letters in Two input string














































Python Program to check Common Letters in Two input string



Description:

Let us assume that there are two input strings "hey" and "hello". We have to find the common letters between both of them.

for this purpose, we have to use "&" operator after converting both strings into sets.


Input Code:

str1= input("Enter Your first string: ")
str2=input("Enter Your second string: ")
s=list(set(str1)&set(str2))
print("The common letters are:")
for i in s:
    print(i)

Output:

Enter Your first string: hey
Enter Your second string: hello
The common letters are:
e
h


Comments