1

Thanks for your help

Example byron = bYrOn

This is an old homework I'm looking over.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
A J E
  • 83
  • 5

1 Answers1

0

It is actually preety simple to turn all letters in a string to upper case!

just use the variable name and follow .upper() at the end e.g.

byron="byron"

byron=byron.upper()

however, because you want to give only certain letters the "uppercase" status, you'd want to first assign all vowels:

vowels = set(['a','e','i','o','u'])

then use some python logic to do the rest:

for char in byron:
    if char in vowels:
        Word = Word.replace(char,(char.upper()))
print (Word) 

if you want to be quick just copy the code below as it is the complete code used to do your task:

x="byron"
vowels = set(['a','e','i','o','u'])
Word=x
for char in Word:
    if char in vowels:
        Word = Word.replace(char,(char.upper()))
print(Word) 
Coder Cody
  • 95
  • 1
  • 10