0
A programming question
Create a program inputs a phrase (like a famous quotation) and prints all of the words that start with h-z Sample input: enter a 1 sentence quote, non-alpha separate words:Â Wheresoever you go, go with all your heart Sample output: WHERESOEVER YOU WITH YOUR HEART ( specially in python)
2 Answers
0
Hi, Here is the solution:
********************************************************
import re
string = input("Insert sentence:\n")
regex = r"\b[H-Zh-z]+\w*\w"
matches = re.findall(regex, string)
for match in matches:
print (match)
**********************************************************
Using regular expression: \b[H-Zh-z]+\w*\w
For math the right words
0
https://code.sololearn.com/cMhmlF3Ty6lz/?ref=app
I think this and is more appropriate