Phase 5 - Category 2: Character Operations
Master character-level string operations.
10 programs · open one, then the next
Start with Print First Character- 01Print First CharacterBeginnerPrint a string's first character safely with indexing. Beginners guard empty input before using index zero and see why leading spaces are real characters.Open example →py# Take string input s = input("Enter a string: ") # Print first character
- 02Print Last CharacterBeginnerAccess the final character of a Python string with negative indexing. Students check for empty input and distinguish index minus one from a one-based position.Open example →py# Take string input s = input("Enter a string: ") # Print last character
- 03Print Each CharacterBeginnerPrint every character of entered text on its own line with Python. Students iterate directly over a string and see how spaces and empty input affect output.Open example →py# Take string input s = input("Enter a string: ") # Print each character
- 04Count Uppercase CharactersBeginnerCount uppercase characters using isupper. Students test characters individually and counting uppercase letters from asking whether an entire string is uppercase.Open example →py# Take string input s = input("Enter a string: ") # Count uppercase
- 05Count Lowercase CharactersBeginnerCount lowercase characters in a string. Students use islower on individual characters and keep lowercase frequency separate from converting the whole response.Open example →py# Take string input s = input("Enter a string: ") # Count lowercase
- 06Count Digits in StringBeginnerCount digit characters inside mixed text with isdigit. Students scan a string without int conversion and distinguish this task from counting an integer's places.Open example →py# Take string input s = input("Enter a string: ") # Count digits
- 07Count Special CharactersIntermediateCount special characters but exclude whitespace with Python. Students combine two negated tests and distinguish punctuation from letters, digits, and spaces.Open example →py# Take string input s = input("Enter a string: ") # Count special characters
- 08Toggle CaseIntermediateToggle letter case with a character loop. Students choose upper or lower conversions per character and copy digits and punctuation into a new result unchanged.Open example →py# Take string input s = input("Enter a string: ") # Toggle case
- 09Remove VowelsIntermediateRemove English vowel characters from text with a loop. Students build a new result from nonmatches and preserve spaces, punctuation, and remaining letter order.Open example →py# Take string input s = input("Enter a string: ") # Remove vowels
- 10Remove ConsonantsIntermediateRemove consonants while keeping English vowels and nonletters. Students trace an or condition and avoid confusing consonant deletion with keeping vowels only.Open example →py# Take string input s = input("Enter a string: ") # Remove consonants