RG's E-Learning Centre · Book a free demo class · WhatsApp +91-9379416374

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

  1. Identify the method and its arguments.
  2. Apply it to the original string (it does not change).
  3. Write the exact output, including quotes for strings in a list.

Worked example 1 (Basic)

What does "classroom".count("c") return?

  1. Occurrences of "c": 1
  2. Answer: 1

Worked example 2 (Standard)

What does "banana".find("ana") return?

  1. First match starts at index 1
  2. Answer: 1

Worked example 3 (Challenge)

What is "banana".replace("a", "A").split("A")?

  1. replace gives "bAnAnA"
  2. split on "A"
  3. Answer: ['b', 'n', 'n', '']

Common mistakes and misconceptions

  • Expecting the original string to change
  • find() returning an error instead of −1

Practice questions

  1. (Basic) What does "committee".count("t") return?
  2. (Basic) What does "assessment".count("t") return?
  3. (Standard) What does "bookkeeper".find("ook") return?
  4. (Standard) What does "mississippi".find("iss") return?
  5. (Challenge) What is "classroom".replace("m", "M").split("M")?
  6. (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.

Book a free demo class