6.100L | Fall 2022 | Undergraduate

# Introduction to CS and Programming using Python

## Lecture 9: Lambda Functions, Tuples, and Lists

Topics: Tuples and lists

### Lecture Notes

Lecture 9: Lambda Functions, Tuples, and Lists

Lecture 9 Code

Ch 5.1–5.3

### Finger Exercise Lecture 9

Implement the function that meets the specifications below:

``````def dot_product(tA, tB):
"""
tA: a tuple of numbers
tB: a tuple of numbers of the same length as tA
Assumes tA and tB are the same length.
Returns a tuple where the:
* first element is the length of one of the tuples
* second element is the sum of the pairwise products of tA and tB
"""

# Examples:
tA = (1, 2, 3)
tB = (4, 5, 6)
print(dot_product(tA, tB)) # prints (3,32)
``````

6.100L Finger Exercises Lecture 9 Solutions

### Problem Set 2

Problem Set 2

Problem Set 2 Code

### Recitation 4

Recitations were smaller sections that reviewed the previous lectures. Files contain recitation notes and worked examples in code.

Recitation 4 Notes and Code

## Course Info

Fall 2022
##### Learning Resource Types
Lecture Videos
Lecture Notes
Problem Sets
Programming Assignments with Examples