boa tarde, meu código esta dando este erro:
e meu código esta assim:
class Restaurante:
restaurantes = []
def __init__(self, nome, categoria):
self.nome = nome
self.categoria = categoria
self._ativo = False
Restaurante.restaurantes.append(self)
def __str__(self):
return f'{self.nome} | {self.categoria}'
def listar_restaurantes():
for restaurante in Restaurante.restaurantes:
print(f'{restaurante.nome} | {restaurante.categoria} | {restaurante.ativo}')
@property
def ativo(self):
return '⌧' if self.ativo else '☐'
restaurante_praca = Restaurante('Praça', 'Gourmet')
restaurante_pizza = Restaurante('Pizza', 'Italiana')
Restaurante.listar_restaurantes()