Mar-05-2020, 07:48 PM
In first snippet it was not working because you were checking that string
In the second one you introduce different error.
you create new variable
still you check in
you want to do
I see that assignment indeed ask menu to be string keep the list for future
string formatting is not what you think
'menu_ask'
is in the menu
. Note, not the variable menus_ask
which has value pizza
, but literally the string 'menu_ask'
In the second one you introduce different error.
you create new variable
new_menu
which has 'soup` as part of the stringstill you check in
menu
, which does not have soup
you want to do
menu = menu + ", " + add_item
I see that assignment indeed ask menu to be string keep the list for future
string formatting is not what you think
print('{} in the new menu = {}'.format(men_ask, menu_ask in menu))or with f-strings
print(f'{menu_ask} in the new menu = {menu_ask in menu}')
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs