Q. Define what we mean by traversal of a string. Write a program that inputs a word (as a string, of course) and prints back the word without the vowels, like this:
If input word is "nectarine" then output should be 'nctrn'.
If input word is "blueberry" then output should be 'blbrry'
Answer :-
Traversing refers to iterating through the element of a string one character at a time.
Program :-
string = input ("Enter the word :- ") newstring = "" for i in string : if i not in "AEIOUaeiou": newstring += i print (newstring)
Output :-
Enter the word :- nectarine
nctrn
>>>
Enter the word :- blueberry
blbrry
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )