r"(inputted word)"______in re.findall | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

r"(inputted word)"______in re.findall

How can I add inputted word to r? import re quote = "Always do your best. Your best is going to change from moment to moment; it will be different when you are healthy as opposed to sick. Under any circumstance, simply do your best, and you will avoid self-judgment, self-abuse and regret" word = input() #место для вашего кода pattern = r"word" <---------------- print(len(re.findall(pattern, quote)))

19th May 2021, 9:03 AM
Александр Грамович
Александр Грамович - avatar
1 Answer
0
Александр Грамович, use the format function to form the pattern. Look at the code. https://code.sololearn.com/cjFS32rW9WEZ/?ref=app
19th May 2021, 9:19 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar