This module covers strings, lists, and files; mastery of these topics will allow us to start working with interesting real-world data.

Learning Outcomes

After completing this module, students should understand

  • Common techniques for creating, modifying, and using strings

  • How to insert values into a string using f-strings

  • Common techniques for creating, modifying, and using lists

  • What container data types and ordered sequences are

  • How to access an item in an ordered sequence by index

  • How to extract a subsequence using slice notation

  • The difference between mutable and immutable data types

  • What aliasing is, why it can be problematic, and how to avoid it

  • The difference between relative and absolute paths

  • How to create a file object

  • How to write to and read from files

  • What a context manager is and how to use a file object as a context manager

Additional Readings