Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
BYU Math 495R
BYU Math 495R
  • About This Course
  • Setting Up Google Colab
  • Lab 1: LaTeX
    • LaTeX Basics
    • Typesetting Mathematics
    • Page Elements
    • The Process
    • Exercises
    • Bonus: Customization
  • Lab 2: Plotting
    • Line Plots
    • Scatter Plots and Histograms
    • Visualization and Analysis
    • Exercises
  • Lab 3: More Loops
    • Loop Tools
    • Nested Loops
    • The WHILE Loop
    • Exercises
  • Lab 4: Iterables
    • Tuples and Lists
    • Sets and Dictionaries
    • Itertools
    • Exercises
  • Lab 5: The Caesar Cipher
    • Encryption and Ciphers
    • Strings
    • Caesar (Shift) Cipher
    • Exercises
  • Lab 6: The Vigenère Cipher
    • Vigenère Encryption
    • Finding the Key Length
    • Exercises
  • Lab 7: Cracking Ciphers
    • Cipher Cracking Strategy
    • Caesar Groups
    • Cracking the Cipher
    • Exercises
  • Lab 8: Recursion
    • Recursive Thinking
    • Branching Recursion
    • The Determinant
    • Exercises
  • Lab 9: The Euclidean Algorithm
    • Greatest Common Divisors
    • The Extended Algorithm
    • The Special Linear Group
    • Exercises
  • Lab 10: Prime Factorization
    • Prime Numbers
    • Factorization
    • Prime Sieves
    • Exercises
  • Common Errors
Back to top

Lab 4: Iterables¶

Open Lab Notebook in Google Colab

Learning Objectives

  1. Build lists incrementally with append(), and use other common list methods.

  2. Build lists all at once with list comprehension.

  3. Introduce the set class for storing unique values and perform fast membership checks.

  4. Introduce the dict class for storing key-value pairs.

  5. Use the itertools module to iterate over sequences in specialized ways.

Lab Outline

  • Tuples and Lists
  • Sets and Dictionaries
  • Itertools
  • Exercises
Next
Tuples and Lists
Previous
Exercises
Copyright © 2026, Brigham Young University Department of Mathematics
Made with Sphinx and @pradyunsg's Furo