Every Seat Taken by Ben

Python for AIMedium+10 XP+10

Every Seat Taken by Ben

A cinema keeps a list of who sits in each seat, left to right. Seat numbers start at 0.

Write seats_of(seating, name). It returns a list of every seat number where name appears, from smallest to largest.

  • The match must be exact ("ben" is not "Ben").
  • If the name isn't there at all, return an empty list.

Examples

seating = ["Ada", "Ben", "Cleo", "Ben"]
name = "Ben"
returns [1, 3]
seating = ["Ada", "Cleo"]
name = "Ben"
returns []

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run