Basta Fazoolin'

So I keep getting this for some reason:

Traceback (most recent call last):
  File "", line 67, in <module>
TypeError: __repr__ returned non-string (type NoneType)

This is what I’ve done so far:

class Menu():
  def __init__(self, name, items, start_time, end_time): = name
    self.items = items
    self.start_time = start_time
    self.end_time = end_time
  def __repr__(self):
    def __init__(self, name, items, start_time, end_time):
      super().__init__(name, start_time, end_time)
      return "{name} is available from {start_time} to {end_time}".format(name =, start_time = self.start_time, end_time = self.end_time)
class Franchise():
  def __init__(self, address, menus):
    self.address = address
    self.menus = menus
  def __repr__(self):
    return self.address
  def available_menus(self, time):
    available_menus = []
    for menu in self.menus:
      if time >= menu.start_time and time <= menu.end_time:
    return available_menus
menus = [brunch_menu, early_dinner_menu, dinner_menu, kids_menu]

#Franchise shops:
flagship_store = Franchise("1232 West End Road", menus)
new_installment = Franchise("12 East Mulberry Street", menus)

Please help. I’ve been stuck on this for a while now. I’ve compared with the walkthrough video as well but I don’t really get what I’m doing wrong.

Thanks in advance!!

You understand what __repr__ is and what it does, right? Then why is there an init magic method nested in the repr function?

1 Like