Home / Python Tips Generated By ChatGPT / Slicing Lists and Strings in Python Use slicing to access parts of lists or strings. Source Code my_list = [0, 1, 2, 3, 4] print(my_list[1:3]) # [1, 2] my_string = "Hello" print(my_string[:2]) # "He"