0
0
0x00000072021-08-10 22:48:48
Python
0x0000007, 2021-08-10 22:48:48

How to get identical words from variables?

There are two variables:

a = ('магазин, холодильник, утюг, бытовая техника,  стиральная машина')
b = ('шкафы, магазин, стулья, стиральная машина, язык, строка, холодильник')

How to get the same words from these two variables, in this case - a store, a refrigerator, a washing machine?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2021-08-10
@0x0000007

set(a.split(', ')) & set(b.split(', '))
(only double spaces can be a problem)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question