Reading about strings
Knowing how to read and interpret documentation is a terrifically useful skill that will help support your independent learning goals. It’s important to me that you get some experience reading technical documents in this class. I would like you to start by reading this book chapter and answering a few questions about it on a separate sheet of paper to turn in. Make sure you are trying things at the shell as you go!
- What is a string?
- How would you figure out how many characters a particular string has in it?
- How would you attach two strings together and display them as one?
- In what context might string slicing be useful (think carefully of software you’ve used)?
- What is a method?
- How are methods different from functions?
- Read about different string methods in the official Python documentation. Note that parameters in brackets are optional. For example, when you call the method str.replace(old, new[, count]), you must specify the string to replace (old), what to replace it with (new), and you can optionally specify a number of the old string to replace. For example:
"banana".replace("a", "o")will give you back"bonono"and"banana".replace("a", "o", 2)will give you back"bonona"
Find the three methods you think would be the most useful and describe them in detail. How would they be useful? - Complete exercise 12 (on the computer). You can get information on built-in functions here.
Done? Check out lists!




