Please click on ads

Please click on ads

Wednesday, 3 March 2021

to remove the consonant from the string in python..

 a =input('enter the string')


# printing original string
print("The original string is : " + a)

# Remove all consonents from string
# Using loop
res = []
for i in a:
if i in "aeiouAEIOU":
res.extend(i)
res = "".join(res)

# printing result
print("String after consonents removal : " + str(res))

No comments:

Post a Comment