python-lists & strings
**Python Lists & Strings (100 words):** - **Lists** are ordered, mutable collections. They can store heterogeneous data types and support operations like indexing, slicing, and iteration. Lists are defined using square brackets `[]`. Example: ```python my_list = [1, 2, 'Python', 3.5] ``` - **Strings** are immutable sequences of characters. Strings are enclosed in single, double, or triple quotes. They support indexing, slicing, and string methods (e.g., `.lower()`, `.replace()`). Example: ```python my_str = "Hello, World!" print(my_str[0]) # Output: 'H' ``` Both can be manipulated using built-in methods, such as `append()`, `extend()` for lists and `split()`, `join()` for strings.
Written for
- Institution
- RPS COLLEGE OF ENGINEERING AND TECHNOLOGY
- Course
- 90505
Document information
- Uploaded on
- October 4, 2024
- Number of pages
- 18
- Written in
- 2023/2024
- Type
- Class notes
- Professor(s)
- Diksha
- Contains
- B.tech computer science engineering python notes
Subjects
-
python notes
-
cse hand made notes