Capitalize First Letter of Each Word
Capitalize first letter of each word.
IntermediatePhase 5 - Category 3: Word OperationsExample 6 of 10
capitalize-first-letter-of-each-word.py
1# Take string input2s = input("Enter a string: ")34# Capitalize first letter of each word5result = s.title()6print(f"Capitalized: {result}")
Output
Enter a string: hello world Capitalized: Hello World
What's going on
Use title() method to capitalize.
Key Concepts:
title() capitalizes first letter of each word
Returns new string
Simple one-line solution
🔗Related Content
- 📖
Phase 5 - Learn Concepts
Review Phase 5 concepts and explanations
- 📝
Phase 5 - Quiz
Test your Phase 5 understanding with quiz questions
- 💻
Phase 5 - All Practice Problems
Explore all practice problems for Phase 5
- 🎓
Master Your Logic Building - Complete Course
Browse all phases and tutorials
- 🧠
Logic Building Overview
Learn about the complete logic building curriculum