Read the question, write Python on the right, then Run or Check.
QuestionHint and solution stay closed until you open them
Read one line of words and print it in title case: the first letter of each word capitalised, the rest lowercase.
Python's str.title() does exactly this.
Input. One line of text.
Output. The same words, title-cased.
Examples
Input
hello world
Output
Hello World
Input
PYTHON labs
Output
Python Labs
Hint
- line.title() capitalises each word.
- strip() the line first so a stray newline does not linger.
Show correct code
Peek only after you have tried. You can still Check your own version.
print(input().strip().title())
main.pyPython · Ctrl + Enter runs
ResultIdle
Run to see output. Check grades the tests.