How to replace the vowels in the string with the vowels in circular order | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to replace the vowels in the string with the vowels in circular order

In python 3

8th Apr 2019, 4:27 AM
Karthik Devillers
Karthik Devillers - avatar
13 Answers
+ 3
Fermi what is the import re does And re.sub does I can't understand
8th Apr 2019, 5:01 AM
Karthik Devillers
Karthik Devillers - avatar
+ 3
What does iter do? What does print do? What does n%5 mean? Sorry man, but you're not going to learn anything if you ask others to think for you
9th Apr 2019, 5:19 AM
Anna
Anna - avatar
+ 1
Can you give us examples of what input and what corresponding output you expect to get? "Vowels in circular order" is a little vague.
8th Apr 2019, 4:37 AM
Fermi
Fermi - avatar
+ 1
Do you mean shifting the vowels by three places? a -> o e -> u i -> a o -> e u -> i
8th Apr 2019, 4:48 AM
Diego
Diego - avatar
+ 1
str = 'King Kong' vowelorder = 'a,e,i,o,u'.split(',') n = 0 for i in str: if i in vowelorder: print(vowelorder[n%5], end='') n+=1 else: print(i,end='') # cheers, but you should have shown your own attempt!
8th Apr 2019, 4:58 AM
Fermi
Fermi - avatar
0
Input :King Kong Output :kang keng Vowels in string are i and o they are replaced by a and e like.wise
8th Apr 2019, 4:39 AM
Karthik Devillers
Karthik Devillers - avatar
0
Same aeiou
8th Apr 2019, 4:58 AM
Karthik Devillers
Karthik Devillers - avatar
0
Sorry, no need for regex. I was thinking along the lines of substituting the characters. If you want to learn more about regex, give it a search in the Learn section. :>
8th Apr 2019, 5:02 AM
Fermi
Fermi - avatar
0
What does n%5 indicates
8th Apr 2019, 5:03 AM
Karthik Devillers
Karthik Devillers - avatar
0
What does iter do
9th Apr 2019, 5:08 AM
Karthik Devillers
Karthik Devillers - avatar
- 1
Nope ..diego
8th Apr 2019, 4:55 AM
Karthik Devillers
Karthik Devillers - avatar
- 1
What's the output of "aeiou"?
8th Apr 2019, 4:58 AM
Diego
Diego - avatar