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
1 changed files with 2 additions and 0 deletions

View File

@ -235,6 +235,8 @@ def resto_menu():
else:
def table_for(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))
return "\n".join("{name: <{width}}{price}".format(
name=item["name"],