Write a program to replace vowels by next vowel using list comprehension + zip()


Topic: Write a program to replace vowels by next vowel using list comprehension + zip()

Solution

  
test_str = 'helloworld'
print("The original string is : " + str(test_str)) 
vow = 'a e i o u'.split() 
temp = dict(zip(vow, vow[1:] + [vow[0]])) 
res = "".join([temp.get(ele, ele) for ele in test_str]) 
print("The replaced string : " + str(res)) 



List all Python Programs