Display None when there is none

This commit is contained in:
Robbe Van Herck 2019-03-18 11:56:32 +01:00
parent 25d7d73255
commit e0ced162f4
No known key found for this signature in database
GPG key ID: 4D1C8E8FBD1C7188

View file

@ -235,6 +235,8 @@ def resto_menu():
else: else:
def table_for(kind): def table_for(kind):
items = [meal for meal in resto["meals"] if meal["kind"] == kind] items = [meal for meal in resto["meals"] if meal["kind"] == kind]
if len(items) == 0:
return "None :("
maxwidth = max(map(lambda item: len(item["name"]), items)) maxwidth = max(map(lambda item: len(item["name"]), items))
return "\n".join("{name: <{width}}{price}".format( return "\n".join("{name: <{width}}{price}".format(
name=item["name"], name=item["name"],