Basta foozlin' step 16

I would much appreciate anyone willing to help as I am getting rather frustrated. I am on step 16 which r eturns the available menus. I realized why my code wasnt working… self.menus (or rather flagship_store.menus) returns [brunch menu is available from 11 to 4, Early Bird menu is available from 3 to 6, Dinner menu is available from 5 to 11, Kids Menu menu is available from 11 to 9] rather than [brunch, early_bird, dinner, kids] which means I cannot iterate though it. Thank you so much in advance. I have spent forever trying to fix it and watch the walk through.

\

that’s what brunch/earl_bird/dinner/kids refer to.
that’s the same thing

a = 5
[a]  # [5]

and it doesn’t prevent you from iterating, it’s a list, you can iterate through a list

if you want a list of text then use strings.

['a']  # ['a']

Thank you for replying. If that is true, then why does my .available_menus not work?

I don’t know what not work means.

But if you think it should be doing something else then you could make observations about what it is doing to find out where it starts doing something other than what you meant.

I should have clarified, it returns an empty list. It in theory should iterate through flagship_store’s menus (brunch, early_bird, dinner, kids) and if the time given when calling flagship_store.available_menus(4) should return the menus that are open (between .start_time and .end_time). I have looked at the walk through and mine seems to be the same as his but only my returns an empty list. The reason why I concluded that it was because flagship_store.menus returned a list that did not contain the items that I wanted to iterate through in my method. Thank you for your time.

Yeah so what steps did it carry out to arrive at an empty list?

Jim is making pizza. Jim serves a burger.
Want went wrong? Watch Jim cook.

You could also read the recipe, that would be your code. Either works.

It is probably because my flagship_store.menus is **[brunch menu is available from 11 to 4, Early Bird menu is available from 3 to 6, Dinner menu is available from 5 to 11, Kids Menu menu is available from 11 to 9] and not [brunch, early_bird, dinner, kids]. Not to be disrespectful but I have analyzed my code numerous times and have resorted to the forums for someone to look at it and help. So my response would be, I am not sure why flagship_store.menus is returning that and I have already gone through my code and would like a second pair of eyes to maybe see something that I do not.

I thought we agreed those were one and the same.

You don’t need a second pair of eyes. But you do need to follow along in what happens, observing the operations carried out while comparing to what you meant.

To observe something is to obtain information about it, to make measurements.

Ask jim to tell you what he’s doing for each thing he does, that’ll give you enough information about where jim stopped making pizza and started making burgers that you’ll be able tell jim what adjustments to make.

So for example. Are you executing an instruction that says append? How many iterations happen? Are there conditions involved, what do those conditions evaluate to, and so on.

What length does your list have? If you iterate through that list, how many iterations should that therefore be?

You can test that.

for thing in menu:
    print('hi')

how many times should/does that say hi?


You’re the one writing the code. Nothing in it is hidden from you, you decide how it behaves, you make it emit whatever information you’re looking for. You can test things you can change things you can print things.

How do you think I’d figure it out?
Well, I read the code, I suppose in some sense I’m better accustomed to correctly interpreting at least simple things in a way that would make me run into the mistake. But if that wasn’t enough (reasonable) then I would start looking at what was carried out.


You should in general expect to be able to fix any code you write.
It’s not about a second pair of eyes.
It’s not about being lucky or good and getting it right.
Dig in. Find out what happened.