Summary

  1. A sequence is an ordered list of items, such as stock prices or exam scores.
  2. Python strings are sequences of characters, where each character is also a string.
  3. You can access individual characters in a string using indexing, e.g., "help"[0] returns 'h'.
  4. Strings can be processed as whole entities or by accessing specific characters.
  5. Operators like + can concatenate strings, e.g., "Hello" + " World" gives "Hello World".
  6. Methods like .upper() can be called on string objects to transform them, e.g., "hello".upper() returns "HELLO".
  7. String literals are explicit string values in the source code, useful for initial assignments.
  8. The join method can concatenate strings with a separator, e.g., ".".join(["192", "168"]) returns "192.168".
  9. The split method divides a string into a list based on a delimiter, e.g., "192.168.1.1".split(".") gives ['192', '168', '1', '1'].
  10. Escape sequences like \n for new lines and \t for tabs add special characters to strings.
  11. In Python, strings are objects, and their methods can be used for various operations.
  12. Strings are immutable, meaning their content cannot be changed once created.
  13. To modify a string, you create a new string, not alter the original.
  14. Indexing retrieves single characters from a string, e.g., "Monty"[0] gives 'M'.
  15. Slicing retrieves substrings, e.g., "Monty"[0:3] gives 'Mon'.
  16. Regular expressions specify patterns for matching strings using special characters.
  17. The match method checks if a pattern matches a string, returning a Match object.
  18. Formatting strings using the format() method inserts variables into strings at specified positions.
  19. String methods like .upper() return new strings without modifying the original.
  20. Encoding converts characters to their numeric Unicode representations, and decoding reverses this.