Creating strings and extracting substrings
Strings in Python are created by enclosing characters in quotes. Python treats single and double quotes identically, allowing you to include one type of quote within the other without escaping. Triple quotes allow strings to span multiple lines and preserve formatting. Strings support indexing (accessing individual characters) and slicing (accessing substrings). Indexing starts at 0 for the first character and supports negative indexing (-1 for the last character). Slicing uses the syntax [start:stop:step] where start is inclusive, stop is exclusive, and step determines the increment. Omitting start defaults to 0, omitting stop defaults to the end, and omitting step defaults to 1. Strings are immutable, meaning you cannot change individual characters, but you can create new strings through operations. Understanding string indexing and slicing is fundamental for text processing tasks like extracting information, parsing data, and manipulating text content in various applications.