2

I have this:

word = raw_input("enter a word")
word[0].upper()

But it still doesn't make the first letter uppercase.

agold
  • 6,140
  • 9
  • 38
  • 54

1 Answers1

1

.upper() returns a new string because strings are immutable data types. You ought to set the return value to a variable.

You can use .capitalize over .upper if you want to make only the first letter uppercase.

>>> word = raw_input("enter a word")
>>> word = word.capitalize()

Please note that .capitalize turns the rest of the characters to lowercase. If you don't want it to happen, just go with [0].upper():

word = word[0].upper() + word[1:]
Ozgur Vatansever
  • 49,246
  • 17
  • 84
  • 119