Here is what I want to do but doesn\'t work:
mystring = \"hello world\"
toUpper = [\'a\', \'e\', \'i\', \'o\', \'u\', \'y\']
array = list(mystring)
for c in arr
Use generator expression like so:
newstring = ''.join(c.upper() if c in toUpper else c for c in mystring)
Easy method
name='india is my country and indians are my brothers and sisters'
vowles='a','e','i','o','u'
for name_1 in name:
if name_1 in vowles:
b=name_1.upper()
print(b,end='')
else:
print(name_1,end='')
You can do:
mystring = "hello world"
toUpper = ['a', 'e', 'i', 'o', 'u', 'y']
>>> ''.join([c.upper() if c in toUpper else c for c in mystring])
hEllO wOrld