
Learning outcomes
By the end of this chapter, you should be able to:- use important string methods
- split and join text data
- format output cleanly
- solve basic string problems
Common string methods
Split and join
String formatting
Basic pattern problems
Palindrome check
Frequency of characters
Exam-focused points
strip()removes leading/trailing spaces onlyfind()returns-1if not foundsplit()output type is list- f-strings are preferred for readable output
Practice questions
- Count vowels in a string.
- Replace all spaces with
_. - Check whether two strings are anagrams (basic approach).
