Python Practice › String Programs › Program 81
Remove symbols and capitalise
Write a Python program to remove unwanted characters from a string and capitalise it.
Input
"sqa****too^^{ls"Output
Sqatools
Approach
- Keep letters only, then
capitalize().
Solution
text = "sqa****too^^{ls"print("".join(ch for ch in text if ch.isalpha()).capitalize())Output
Sqatools
Learn the concept
New to this topic? Read the lesson, then come back.