Novice · Strings · 43 of 264
Title case
Read a line and print it with the first letter of every word in capitals.
Input: one line in small letters. Output: the same line in title case.
Examples
Input
the lord of the rings
Output
The Lord Of The Rings
Input
hello world
Output
Hello World
Input
python
Output
Python
One more test checks other inputs when you press Check.
Stuck? The idea behind strings
A string is text. len() counts its characters; word[0] is the first, word[-1] the last; word[1:4] is a slice, from position 1 up to (not including) 4.
Methods give a new string and leave the old one as it was: .upper(), .lower(), .strip(), .replace(old, new), .split().
word = input() print(len(word)) print(word.upper()) print(word[::-1]) # backwards
Watch for: word.upper() on its own line changes nothing: keep the result (word = word.upper()) or print it.