Testing, testing


#1

If you wanted to have the final output capitalize the first letter of the pyglatin word, how would you use .upper() to do that?
As in, have new_word use .upper() just on the first letter [0] to produce a cleaner result to be printed.
My brains are kind of mush today and I can't seem to get it to work on my own, what's the proper syntax etc?


#2

pretty straight forward:

first = word[0].upper()

you can simply make first uppercase


#3

neat, thanks!
i got it to work using new_word = new_word[0].upper() + new_word[1:len(new_word)] but that's obviously messy and convoluted.


#4

it doesn't actually work? because first is moved to the middle.


#5

oh you're right. is there a less convoluted way to get this result besides the one i posted above?
total python newbie :confused:


#6

not really, personally i would use a built-in method like .title():

print new_word.title()

#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.