Loading topic
int, str and bool, and can write a for loop and call a method. Slicing, which reads several items at once, comes in the next chapter.4 min readitems[0] and items[-1], and write a basic for loop. Slicing builds on indexing. A slice picks out a range of items instead of one, and it can also replace or delete a range.4 min readint, str and bool, write for loops and if statements, and call funct4 min readfor loops and calling methods. By the end you will know which of four removal tools fits a given job, what each one return4 min readin operator tells you whether a value is present. The index method tells you where the first match is. The count method tells you how many matches there are. This chapter assumes you can index and slice lists,5 min readNone. If that last point is unfamiliar, review the chapter on mutability first.6 min readfor loop, index and slice a list, and know that lists are mutable. It covers how iteration over a list works, the idioms Python provides for it, and the bugs that appear when the list changes during the loop.5 min readfor loops and if statements, call methods such as append, and read a basic function call. It also assumes you know that a list is a mutable sequence. It builds on iteration and does not repeat how loops work.4 min readappend. It covers what happens when two names refer to one list, how to make a real copy, and why a copy of a nested list can still share data with the original.4 min readfor loop and a basic list comprehension. It builds on those ideas and shows where they cause trouble once lists hold lis4 min readappend, remove, pop, sort), list comprehensions, and the difference between a name and the object it 5 min readappend, insert, pop, remove, sort, slicing), can write for loops, and have run Python scripts or used 5 min readappend and pop, and loop over a list. You should also know that list operations have different costs, which the previous chapter on performance covered. Here you will use those costs to decide when a list is the right tool for a stack or a q5 min read