SHSubjectHub

Methods and __str__ (Python)

OOPA-levelLesson packSubscription

About this resource

Learn how to add methods to a class so objects can do things, and use __str__ to control how objects print.

10 slides.

Lesson outline

  1. Methods — What Objects Can Do
  2. Adding Methods: Live Demo
  3. UML — Adding the Methods Section
  4. The Problem with `print(rex)`
  5. Adding `__str__`: Live Demo
  6. Python vs C#: Same Idea, Different Syntax
  7. Coding Practice: The Counter Class
  8. Lesson Summary
Unit bundleUnit 1B · Methods and __str__
Part of: Unit 1B · Methods and __str__: the whole unitEvery resource in the unit in one zip.

More from Unit 1B · Methods and __str__