This code takes all the vowels in a string and flip thier positions.
class Solution:
def reverseVowels(self, s: str) -> str:
list_vowels= [x for x in s if x in 'aeiouAEIOU'][::-1]
list=[x for x in s]
z=0
for number in range(0,len(s)):
if list[number] in 'aeiouAEIOU':
list[number]=list_vowels[z]
z+=1
return "".join(list)
I'm still a beginner but I have this feeling that if I submit this code in an interview for exemple, I won't be taken seriously.
Thanks to who ever took time to help me.