Computer Science, asked by anish123khanal, 12 days ago

. Write a program that takes 2 words as input from the user and prints out a list
containing the letters which the 2 words have in common. For example, if word1 is “english”
and word2 is “nepali”, the output should be [“l”, “e”, “i”, “n”].

Answers

Answered by somnath91101
0

Answer:

a = input('-->')

b = input('-->')

d = []#List for letters in input a

e = []#List for letters in input b

for x in a:

d.append(x)

for y in b:

e.append(y)

list1_set = set(d)

intersection = list1_set.intersection(e)

intersection_as_list = list(intersection)

print(intersection_as_list)

Similar questions