Loading topic
len() all follow from one model. This chapter builds that model. Later chapters use it to read single characters and cut out slices.6 min readprint() and len(), and read a simple try/except block. This chapter covers reading a single character with a non-negative integer index. Negative indexes, the details of IndexError, and5 min readprint() and len(), and read a simple try/except block. It also assumes you know zero-based indexing from the previous chapter, where s[0] is the first character of s.6 min readprint() and len(), and read a simple try/except block. It also assumes you know how zero-based and negative indexes address characters. Here you will learn exactly which indexes are val6 min readprint() and len(), and read a simple try/except block. It also assumes you know that s[0] is the first character and s[-1] is the last. Here you will learn how s[start:stop] sel6 min reads[i] and s[a:b] with positive and negative numbers, and that you know len() and basic try/except. Here you will learn what Python does when you leave out a bound, and which omissions are safe or risky.6 min reads[start:stop] includes start and excludes stop. You should also be comfortable with len(), print(), and a simple try/except block.6 min readprint() and len(). It also assumes you can read a simple try/except block. You should already know zero-based indexes, negative indexes, and slices of the form s[start:stop]. Here you add the third value of a slice, the step, which contr7 min reads[start:stop] slices with positive and negative indexes, you know that stop is excluded, and you have seen the step value in s[start:stop:step]. Here you will see what changes when the step is negative. You will also learn the defaults that make s[::-1] work6 min readprint() and len(). It also assumes you can read a simple try/except block and know that s[0], s[-1] and s[a:b] read characters from a string. Here you will see what happens when you try to write to a string, and how to get the same r6 min reads[start:stop:step] form, how omitted bounds work, and that strings are immutable. Here you combine those pieces into patterns you will use all the time. You will also learn which edge cases make them fail.5 min reads[1:4], s[::-1] and s[-3:], and that you understand the defaults for omitted bounds. You should also be comfortable with try/except. Here you will see what Python does with the part between the square brackets, and how to use that m5 min readlen() counts items in a sequence and that you can read a try/except block. Here you will learn what the unit of indexing really is, and why a slice that looks correct 6 min read