What’s Your Type?

Jed Rembold

January 23, 2026

Happy Friday!!

Quick Announcements

  • Problem Set 1 is due on Monday night!
  • We are leaving Karel!
    • We’ve already covered everything Karel can do
    • Karel will not understand the things we are talking about today and going forwards
    • Problem Set 2 will have one last Karel problem on it

Group Problems

Problem 1: Arithmetic Operations

What value does the below expression evaluate to? What type of object is the result?

1 * 2 * 3 + (4 + 5) % 6 + (7 * 8) // 9

Problem 2: Names are Hard

Some of the variable names below are invalid. If you take the 3rd character of each invalid variable name, they will form an anagram for a coding concept. What is the hidden word?

user_age 1st_place bag%red first-name _temp_celsius
elif AvgScore the num NUM_ITEMS x2
@angle item_# __secret__ attempt23 time4bed

Problem 3: Updates

What is the final value of the A variable at the end of the code to the right?

>>> A = 10
>>> B = 4
>>> C = A * B
>>> A -= B
>>> A, B, C = C, A, B
>>> A
??

Problem 4: Birthday Variables

  • Get the birth month number of each member of your group, and assign them to the variables A, B, C, etc.

  • Your challenge is to get each of the variables equating to parts of today’s date:

    A = 1
    B = 23
    C = 20
    D = 26
  • You are only allowed to use these variables, arithmetic operations, and for loops, updating from your starting values each step of the way

    • At no point should other numbers show up in your sequence of commands! (Except inside the for loop parentheses, if you use for loops

Live-Coding

Hot Glowing Things

  • Planck’s law governs the amount of light of a certain color that is emitted when something is glowing at a certain temperature \[ B(\lambda, T) = \frac{2hc^2}{\lambda^5} \frac{1}{e^{\frac{hc}{\lambda k_B T}} - 1} \]
  • Where
    • \(\lambda\) in the wavelength (color) of the light in meters
    • \(T\) is the temperature of the object in kelvin
    • \(h\) is Planck’s constant: \(6.62\times 10^{-34}\)
    • \(c\) is the speed of light: \(3\times 10^8\)
    • \(k_B\) is Boltzmann’s constant: \(1.38\times 10^{-23}\)

Goal

  • My goal is to write a short program that would allow a user to define the desired temperature and wavelength at the top, and then compute the brightness of that light

A Solution

wavelength = 400 * 10 ** -9 # meter
temperature =  1000 # kelvin

H = 6.62E-34
C = 3E8 # m/s
KB = 1.38E-23

first_fraction = 2 * H * C ** 2 / wavelength ** 5
exp_fraction = H * C / (wavelength * KB * temperature)
second_fraction = 1 / (2.71828 ** exp_fraction - 1)
brightness = first_fraction * second_fraction

print(brightness)
// reveal.js plugins