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)

26th Jan 2018, 6:55 PM
Naresh
Naresh - avatar
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
27th Jan 2018, 5:11 AM
Alberto Del Angel
Alberto Del Angel - avatar
0
https://code.sololearn.com/cMhmlF3Ty6lz/?ref=app I think this and is more appropriate
27th Jan 2018, 8:24 AM
Naresh
Naresh - avatar