Basta Fazoolin' solution/ how can loop counter 'menu', be same as class Menu()?

Hi everyone,

Solution for Task 16

Question 1) how is a loop counter variable ‘menu’, same as class object Menu() ? its technically 2 different names.
Question 2) does this mean if I use the word menu anywhere in the code, does Python automatically see that as class object Menu() ?

Thanks for your time.

They are not the same thing.
However, menu is being used to store an instance of Menu (meaning that menu holds an object of class Menu) and menu can hold a different Menu object (a different instance of that Menu class) on each iteration of the loop.

I know they are not the same, which I’ve state that already and hence my confusion.
Your answer doesn’t answer my question - you say " However, menu is being used to store an instance of Menu" . Can you explain how, which is really my question, because I don’t cant see how ‘menu’ knows what to do without any explicit referencing to ‘Menu()’ ?

putting it together:
brunch_menu and early_bird menu are instances of Menu,
these are put into a list,
And the list is used as .menus in an instance of Franchise.
for menus in
iterates through that list,
and each thing in that list happens to be an instance of Menu
so each menu is an instance of Menu, meaning a Menu object.

Python doesn’t know anything … its up to whoever is writing the code to make sure the correct kind of objects are in the .menus list so that there’s no errors or unexpected stuff.

menu could have been anything; it just happens to be used to iterate through a list containing Menu objects.

ok. well Codecademy better use better variable names.