Who can Help me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Who can Help me?

I want a Programm in python which can give the number of commun wodrs from two Texts T1 and T2 (the two texts have the same number of words)

11th Apr 2022, 5:29 PM
Aladin Tombari
4 Answers
+ 3
Aladin Tombari , here is a hint how it could be done: - take the input for text1 from user and split() it. this will create a list like t1 - take the input for text2 from user and split() it. this will create a list like t2 - create a counter variable and set it to 0 - iterate with a loop trough t1, and use the given word from the loop variable to count the occurrence of this word in t2. add the resulting value to the value in counter variable - after the loop is done, print the number of common words that is hold in variable counter
11th Apr 2022, 5:55 PM
Lothar
Lothar - avatar
+ 2
Aladin Tombari , if you like to get help from the community, please post your code here. thanks!
11th Apr 2022, 5:39 PM
Lothar
Lothar - avatar
+ 2
THANK YOU SO MUCH U HELPED ME A LOT
11th Apr 2022, 5:57 PM
Aladin Tombari
+ 2
Aladin Tombari , you are welcome!
11th Apr 2022, 6:38 PM
Lothar
Lothar - avatar