Question: 
Write a python function to reverse only the vowels of a given string.


Model's Code:
def reverse_vowels(s: str) -> str:
    vowels = "aeiouAEIOU"
    s_list = list(s)
    i, j = 0, len(s) - 1
    
    while i < j:
        if s_list[i] not in vowels:
            i += 1
        elif s_list[j] not in vowels:
            j -= 1
        else:
            s_list[i], s_list[j] = s_list[j], s_list[i]
            i += 1
            j -= 1
            
    return ''.join(s_list)



Sample Correct Code:
def reverse_vowels(str1):
	vowels = ""
	for char in str1:
		if char in "aeiouAEIOU":
			vowels += char
	result_string = ""
	for char in str1:
		if char in "aeiouAEIOU":
			result_string += vowels[-1]
			vowels = vowels[:-1]
		else:
			result_string += char
	return result_string


Asserts:
assert reverse_vowels("Python") == "Python"
assert reverse_vowels("USA") == "ASU"
assert reverse_vowels("ab") == "ab"


Tests:
Test 1 of 3: PASS
Test 2 of 3: PASS
Test 3 of 3: PASS

Test 131 of 974: 98/131 (74.80916030534351%): success