Logic Building
# Take string input
s = input("Enter a string: ")
# Capitalize first letter of each word
result = s.title()
print(f"Capitalized: {result}")Output
Enter a string: hello world Capitalized: Hello World
Use title() method to capitalize.
Key Concepts:
- title() capitalizes first letter of each word
- Returns new string
- Simple one-line solution