Help me write function that say how many of string 2 is in string 1: | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me write function that say how many of string 2 is in string 1:

Example: string1:dasasasahjasasa String2:asa Answere:5 Ex2:string1:dasrkasas String2:as Answere:3

30th Oct 2019, 6:43 PM
MohammadReza Yadollahi
MohammadReza Yadollahi - avatar
3 Answers
+ 4
print (str1.count (str2))
30th Oct 2019, 6:55 PM
Qasem
0
Have you got any code that you've written to try and solve it? Do you have any ideas for an algorithm for how to do it?
30th Oct 2019, 6:51 PM
Russ
Russ - avatar
0
I am not 100% sure what you mean, but I think you can find the answer you are looking for in the python course. go to the Regular Expressions part
30th Oct 2019, 6:52 PM
Brave Tea
Brave Tea - avatar