Phase 5 - Category 1: Basic String Handling
Master fundamental string operations.
10 programs · open one, then the next
Start with Length of String- 01Length of StringBeginnerMeasure a string with len, including spaces and punctuation. Beginners trace text input and distinguish Unicode code-point length from bytes or visible symbols.Open example →py# Take string input s = input("Enter a string: ") # Get length
- 02Reverse StringBeginnerReverse character order with a Python slice. Students read the negative step in [::-1] and distinguish reversing text positions from reversing whole-word order.Open example →py# Take string input s = input("Enter a string: ") # Reverse string
- 03Convert to UppercaseBeginnerConvert entered text to uppercase with upper. Beginners follow a returned string value and learn which characters change and why the original text is unchanged.Open example →py# Take string input s = input("Enter a string: ") # Convert to uppercase
- 04Convert to LowercaseBeginnerConvert text to lowercase with Python lower. Students trace the returned string, unchanged digits, and why changing case does not validate or clean text.Open example →py# Take string input s = input("Enter a string: ") # Convert to lowercase
- 05Count VowelsBeginnerCount English vowel characters in text with Python. Students traverse a string, test membership in both cases, and count occurrences not distinct letters.Open example →py# Take string input s = input("Enter a string: ") # Count vowels
- 06Count ConsonantsBeginnerCount consonants with a character loop. Students require a letter before excluding vowels and see the English-vowel rule applied to Unicode alphabetic text.Open example →py# Take string input s = input("Enter a string: ") # Count consonants
- 07Count WordsBeginnerCount whitespace-separated words with split and len. Students handle repeated spaces and tabs and distinguish token counting from a language-aware word parser.Open example →py# Take string input s = input("Enter a string: ") # Count words
- 08Check Palindrome StringBeginnerCheck exact text palindromes with Python string reversal. Students trace equality and see how case, spaces, and punctuation can change the final decision.Open example →py# Take string input s = input("Enter a string: ") # Check palindrome
- 09Remove All SpacesBeginnerRemove ordinary space characters with replace. Students follow substring replacement with empty text and distinguish a literal space from tabs or all whitespace.Open example →py# Take string input s = input("Enter a string: ") # Remove spaces
- 10Count Each CharacterBeginnerCount every distinct character with a dictionary. Students update frequencies, include spaces, and display key-count pairs in character-code sorting order.Open example →py# Take string input s = input("Enter a string: ") # Count characters