So I have to create a program that rewrites a string backword and alternates vowels and consonants like in this example:
ex_1:
input -> 'abcdefi'
output -> 'ifedacb'
ex_2:
input -> 'vblsdeloai'
output ->'iladoselbv'
What I did so far:
word = input('the word is: ')
b = word[::-1]
list_vowels = []
list_consonants = []
final_list = []
string = ''
vowels = ['a', 'e','i','o','u']
for i in str(b):
if i in vowels:
list_vowels.append(i)
elif i not in vowels:
list_consonants.append(i)
part where I'm stuck
for j in list_vowels :
final_list.append(j)
for b in list_consonants :
final_list.append(b)
converts my final list into a string
for q in e
string = string + e
print (string)
so I convert the string backwords than I use a for to iterate over every char and compare it to the vowel list. If it is in the vowel list then append to a new list list_vowels if not append it to a new list list_consonants. Now I'm stuck at the part where I have to create a list that is created by the two list list_vowels and list_consonats. I don't now how can I make the two for work simultaniously. The zip functions make the list a tuple and I don't think I can use that. I'm prety new and any help will be awsome. If you think I can aproach this problem differently feel free to tell me I am new to programing and I don't realy now how.