1 of 8

CSE 163

Inheritance

Arpan Kapoor�Summer 2026��💭Icebreaker (discuss with neighbors):

What is your favorite food spot on the Ave?

Add to our Slido!

slido.com

#2348882

2 of 8

Announcements

  • Programming Practice 4 released, due next Thursday
  • Homework 3 - Education due tonight at 11:59 PM!
  • Project Proposals due Sunday night!
  • Homework 4 - Networks releases later today, due two weeks from now!

  • Resubmissions Cycle 1 closes tonight
    • HW1 available to resubmit
    • Resub Cycle 2 opens tomorrow (Saturday) morning
      • Eligible assignments: HW1, HW2
  • Homework 2 - Pokemon grades released

slido.com

#2348882

3 of 8

Grading Policy Updates

  • Programming Practice & Section Check-in Drops:
    • Your single lowest submission in each of these assignment categories will be dropped
  • Homework Rounding:
    • Homework grades will be rounded up to the nearest 10%
    • For example: if you score 91% or higher, your score will round up to 100%
    • A score of 90% will stay at 90%

slido.com

#2348882

4 of 8

Lambdas

  • Lambdas allow us to define functions within the body of our code!

def get_dog_name(d):

return d.get_name()

sorted(dogs, key=get_dog_name)

sorted(dogs, key=lambda d: d.get_name())

slido.com

#2348882

5 of 8

Special Methods

Syntax

Method

x < y

x.__lt__(y)

x > y

x.__gt__(y)

x == y

x.__eq__(y)

x <= y

x.__le__(y)

x >= y

x.__ge__(y)

print(x)

print(x.__str__())

x[i]

x.__getitem__(i)

x[i] = v

x.__setitem__(i, v)

slido.com

#2348882

6 of 8

Inheritance

class Dog:

  def __init__(self, name: str) -> None:

    self._name: str = name

  def bark(self) -> None:

    print(self._name + ': Woof')

class ServiceDog(Dog):

  def __init__(self, name: str, service: str) -> None:

super().__init__(name)

    self._service: str = service

  def bark(self) -> None:

    print(self._name + ‘: *alert bark*')

slido.com

#2348882

7 of 8

Graphs

  • Nodes + Edges
    • Nodes represent data in the graph
    • Edges represent relationships between the data nodes
  • Suppose the diagram on the right represents a “social network”
    • B’s friends: A, D, E
    • C’s friends: A, D
    • B + C’s mutual friends: A, D

  • What else can graphs represent?

slido.com

#2348882

8 of 8

Homework 4 Tips

  • Start early!
  • graphs.py
    • Edges and nodes are in a list for convenience
  • analysis.py
    • Read through the starter code thoroughly (come to office hours if you have questions)
    • Consider what different data structures represent
    • The two recommendation algorithms will be fairly similar

slido.com

#2348882