Code as a Liberal Art, Spring 2025

Unit 1, Lesson 4 Homework

Due: Wednesday, February 19, 8pm

    As we've discussed, for each homework please create a new, clearly named subfolder in your Google Drive folder (for example, Unit 1, Lesson 4 ) and put any files for the assignment in there. Please create a new Python file (.py) for each homework part and name the files accordingly. For example unit1_lesson4_hw_part1.py, or if your folder is accurately named, simply name the file part1.py. Ambiguously labeled homework folders or files may not receive credit if I cannot identify which assignment they are meant to fulfill. Thank you.

  1. Review the class notes for this week.
  2. Working with the code examples from section III, create your own image by building up patterns of pixels using the modulo operator and other techniques from those examples. Try 2-3 versions of this. (Please create different Python files for your different versions. So for example, you might have files named U1L4_homework_part1v1, U1L4_homework_part1v2, etc.) Run your code and upload the output into your homework directory.

  3. [NOTE: Updated after class] Working with the code examples from section II load at least two images and try modifying them with some filtering techniques to create transparency in some way, then collage the images together using either blend() as we discussed in Unit 1, Lesson 3 HW, part 3, or using the techniques described in Unit 1, Lesson 3, part VI like paste() and alpha_composite()

  4. Bonus: If you get this far, try merging the above two approaches, so that you integrate collaging with the pattern-making code. For example, you might create a pattern of transparent pixels in your images, or simply draw blocks and stripes of color into collaged images