Python string methods: Class 11 practice
Strings are immutable; methods like upper(), lower(), count(), find(), replace() and split() return new values. Read the method, follow the three worked examples, then try the six questions.
What you should know first
- String indexing
The idea behind python string methods
Strings are immutable; methods like upper(), lower(), count(), find(), replace() and split() return new values. find() returns −1 when the substring is absent.
Step-by-step method
- Identify the method and its arguments.
- Apply it to the original string (it does not change).
- Write the exact output, including quotes for strings in a list.
Worked example 1 (Basic)
What does "classroom".count("c") return?
- Occurrences of "c": 1
- Answer: 1
Worked example 2 (Standard)
What does "banana".find("ana") return?
- First match starts at index 1
- Answer: 1
Worked example 3 (Challenge)
What is "banana".replace("a", "A").split("A")?
- replace gives "bAnAnA"
- split on "A"
- Answer: ['b', 'n', 'n', '']
Common mistakes and misconceptions
- Expecting the original string to change
- find() returning an error instead of −1
Practice questions
- (Basic) What does "committee".count("t") return?
- (Basic) What does "assessment".count("t") return?
- (Standard) What does "bookkeeper".find("ook") return?
- (Standard) What does "mississippi".find("iss") return?
- (Challenge) What is "classroom".replace("m", "M").split("M")?
- (Challenge) What is "classroom".replace("r", "R").split("R")?
Answer key with full working
- Q1: Occurrences of "t": 2 → Answer: 2
- Q2: Occurrences of "t": 1 → Answer: 1
- Q3: First match starts at index 1 → Answer: 1
- Q4: First match starts at index 1 → Answer: 1
- Q5: replace gives "classrooM" → split on "M" → Answer: ['classroo', '']
- Q6: replace gives "classRoom" → split on "R" → Answer: ['class', 'oom']
Syllabus note
This skill is listed under "Strings in Python" for Class 11 in the NCERT/CBSE books. ICSE, IGCSE, IB and state boards may teach it in a different chapter or year.
Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.
Related practice and notes
Frequently asked questions
Which chapter is python string methods in?
"Strings in Python", Class 11 Computer Science (NCERT/CBSE). Other boards may place it differently.
How were the answers checked?
Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.