CodeTestValidate

No installations needed! Write Python directly in your browser and get instant feedback with our smart validation system.

Challenge # 10

Capitalize First Letter of Each Word

Objective

Transform a string so that each word starts with an uppercase letter.

Instructions

  • You are given a string variable text.

  • Your task is to capitalize the first letter of each word in text.

  • Words are separated by spaces.

  • Print the resulting string with each word capitalized.

Constraints:
Do not use input(). • Assume the input string is lowercase and contains only alphabetic characters and spaces.
Exemple IO

Input: text = "hello world"

Output: Hello World

Input: text = "python is fun"

Output: Python Is Fun

Input: text = "capitalize each word"

Output: Capitalize Each Word

Try It Online!

Output:

Validate Your Results

Get your code reviewed and validated to understand what you did right and where you can improve.

Previous challengeFind Square Root Without math.sqrtNext challengeFlatten a Nested List