Search the Text
Python
15 pts
Search the Text
Given the variable text, create:
times— how many times"Asmara"appears (usecount())position— the index of the word"capital"(usefind())starts—Trueiftextstarts with"Asmara"(usestartswith())
Print them in that order. Expected output:
2 14 True
Checklist
- Keep
textunchanged and createtimes, how often"Asmara"appears. - Create
position, the index where"capital"starts. - Create
starts: whethertextstarts with"Asmara". - Print
times,positionandstarts, one per line.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
