Count Uppercase Characters
Count uppercase characters in string.
BeginnerPhase 5 - Category 2: Character OperationsExample 4 of 10
count-uppercase-characters.py
1# Take string input2s = input("Enter a string: ")34# Count uppercase5count = 06for char in s:7 if char.isupper():8 count += 1910print(f"Uppercase characters: {count}")
Output
Enter a string: Hello World Uppercase characters: 2
What's going on
Check each character if uppercase.
Key Concepts:
isupper() checks if uppercase
Count matching characters
Loop through string
🔗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