Python: Find all adverbs and their positions in a given sentence
Python Regular Expression: Exercise-46 with Solution
Write a Python program to find all adverbs and their positions in a given sentence.
import re text = "Clearly, he has no excuse for such behavior." for m in re.finditer(r"\w+ly", text): print('%d-%d: %s' % (m.start(), m.end(), m.group(0)))
Visualize Python code execution:
The following tool visualize what the computer is doing step-by-step as it executes the said program:
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?