I am trying to convert this function:
templist = []
for each in characters:
if each in vowels:
templist.append('v')
elif (each in alphabet) & (each not in vowels):
templist.append('c')
else:
templist.append('?')
characters = templist
print(characters)
into list comprehension
modified_list = ['v' for each in characters for item in vowels
if item in vowels
else 'c' if (item in alphabet) & (item not in vowels)
else '?']`
Kinda stuck here! Can't figure out what I am doing wrong.