Python Strings - ISC Class 12 Computer Science Notes, Diagrams and Solved Questions

Work with text in Python 3: indexing from both ends, concatenation, repetition and membership, slicing with steps, traversing with loops, and the built-in string methods from capitalize to partition.

In this chapter

  • Recall Python data types and flow of control
  • Index a string from the left and from the right
  • Use +, * and in on strings
  • Slice with start, stop and step, including negative steps
  • Traverse a string with for and while loops
  • Use len, capitalize, title, lower, upper, count, find and index
  • Test strings with startswith, endswith and the is… methods
  • Clean and cut text with strip, replace, split, join and partition