Basta Fazoolin: https://www.codecademy.com/paths/computer-science/tracks/cspath-python-objects/modules/cspath-python-classes/projects/basta-fazoolin
When I got to Step16, my vision of the solution was to produce something like this:
Menu Early Bird available 1500 to 1800
Menu Dinner available 1700 to 2300
Menu Kids available 1100 to 2100
And, I almost did it with this:
def available_menus(self, time):
for menu in self.menus:
if menu.start_time <= time <= menu.end_time:
unfortunately ‘None’ gets added on the end as well.
I figured I use another for loop to iterate over the available_menus, but that was a mess.
Any ideas on what to do to?
Hello! The reason
None gets printed is that you aren’t actually
returning anything from the
availale_menus function. This happens because when you
you’re printing the return value of the function. Since there is no return value,
None gets printed.
Right , I get that.
return available_menus outputs:
[Menu Early Bird available 1500 to 1800, Menu Dinner available 1700 to 2300, Menu Kids available 1100 to 2100]
I tried iterating over available_menus:
for i in range(len(available_menus):
with (predictably) the same result.
How do I convert that to the desired format without
You could simply call the function:
Instead of printing that.
Well, just smack me in the head.