[8] Text I: Strings and Their Slices


[8.2] Strings, Indexing, Slicing

string - a sequence of characters, indicated with surrounding quotation marks—either single or double, as long as both starting and ending quotation marks are the same. They are not numbers.
'' = null string
index - the character's index is its position in the string;

Character number zero is the character that is zero away from the beginning of the string - the first one

[8.3] Selecting a Slice

[8.4] Counting Double Letters

iterating through wyatt and simply find all the occurrences of a double 'e':

Exe. 8-1

[8.5] Strings and Their Length

[8.6] Splitting a Text into Words: First Attempt

split(), divides a string into a list of strings, breaking it apart whenever the specified string (the one given as an argument) is found

[8.7] Working across Strings: Joining, Sorting

join - a method of the string that is used to do the joining; it is not a method of the list

[8.8] Each Word without Joining

[Exercise 8-2] Same Last Character

Write same_last(), a function that accepts two strings as arguments and returns True if they have the same last letter, False otherwise.

[Exercise 8-3] Counting Spaces

Write count_spaces(), a function that accepts a string as an argument and returns the number of spaces in the string. Use iteration to determine this.

[Exercise 8-4] Counting Nonspaces

Write count_nonspaces(), a function that returns the number of characters in a string that are not spaces.