Logic Building
# Take string input
s = input("Enter a string: ")
# Count uppercase
count = 0
for char in s:
if char.isupper():
count += 1
print(f"Uppercase characters: {count}")Output
Enter a string: Hello World Uppercase characters: 2
Check each character if uppercase.
Key Concepts:
- isupper() checks if uppercase
- Count matching characters
- Loop through string