Answer to Question #277805 in Python for Yash Parate

Question #277805

[M5_CSQ5] Construct an algorithm and write a python program python program to create


a regular expression to retrieve all words starting with vowels in each string. [CO2] [L2]


Test Cases are


case=1


case=2


input= An apple for a day input= Actions


keeps the doctor away louder than words.


I


output= An


output= Actions


apple


away


case=3


speak input= Everyone wants to


go to heaven, but nobody


wants to die.


output= Everyone



1
Expert's answer
2021-12-09T17:37:06-0500
import re


regex = '^[aeiouAEIOU]*'


def check(S):


    if(re.search(regex, S)):
        print("Valid")
        
    else:
        print("Invalid")
    


if __name__ == '__main__' :

    S = "anime"
    check(S)


    S = "hello"
    check(S)


    S = "kakashi"
    check(S)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS