Always do your best.problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Always do your best.problem

#Given the 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." #Complete the program so that it will take a word as input and output the number of times that word appears in the quote.

14th Mar 2021, 8:15 PM
Nadhiya Kandaswami
Nadhiya Kandaswami - avatar
7 Answers
+ 1
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() #your code goes here pattern=word print(len(re.findall(pattern, quote)))
9th Apr 2021, 2:49 PM
Nasir Elmurtada
Nasir Elmurtada - avatar
+ 4
Nadhiya Kandaswami Show your attempts.
14th Mar 2021, 8:31 PM
A͢J
A͢J - avatar
+ 2
Thank you so much Nasir Elmurtada
9th Apr 2021, 4:04 PM
Nadhiya Kandaswami
Nadhiya Kandaswami - avatar
0
Only 1 case is solve and other errors are there
14th Mar 2021, 8:48 PM
Nadhiya Kandaswami
Nadhiya Kandaswami - avatar
0
import re quote=r"Always do your best.Your best is oing 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 avoidself-judgment,self-abuse and regret." word=input() match=(re.findall(quote,word)) print(len(match)) What's wrong in this code
14th Mar 2021, 8:49 PM
Nadhiya Kandaswami
Nadhiya Kandaswami - avatar
0
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() #your code goes here count = re.findall(word, quote) print(len(count))
19th Apr 2021, 8:58 AM
Gunjan Patel
Gunjan Patel - avatar
0
Nadhiya Kandaswami you are finding quote in word but you should find word in quote. hope it will help you.
19th Apr 2021, 9:01 AM
Gunjan Patel
Gunjan Patel - avatar