curriculum/challenges/english/blocks/daily-coding-challenges-python/69306364df283fcaff2e1ada.md
Given a string, return a new string where all vowels are converted to uppercase and all other alphabetical characters are converted to lowercase.
"a", "e", "i", "o", and "u" in any case.vowel_case("vowelcase") should return "vOwElcAsE".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(vowel_case("vowelcase"), "vOwElcAsE")`)
}})
vowel_case("coding is fun") should return "cOdIng Is fUn".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(vowel_case("coding is fun"), "cOdIng Is fUn")`)
}})
vowel_case("HELLO, world!") should return "hEllO, wOrld!".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(vowel_case("HELLO, world!"), "hEllO, wOrld!")`)
}})
vowel_case("git cherry-pick") should return "gIt chErry-pIck".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(vowel_case("git cherry-pick"), "gIt chErry-pIck")`)
}})
vowel_case("HEAD~1") should return "hEAd~1".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(vowel_case("HEAD~1"), "hEAd~1")`)
}})
def vowel_case(s):
return s
def vowel_case(s):
vowels = "aeiouAEIOU"
result = ""
for char in s:
if char in vowels:
result += char.upper()
elif char.isalpha():
result += char.lower()
else:
result += char
return result