Jan-07-2018, 11:42 PM
Hello,
I am trying to create an accurate output (below snapshot is not giving me what I need) when I trigger the user to type in the meals they had 24 hours ago like: meat, chocolate, dairy. The output should say False for meat and everything else true but I am not getting that - can someone help me?
Input
menu = '"seafood, dairy, nuts, chocolate"'
input_test = input("enter food categories eaten in the last 24 hours: ").lower()
print('It is',"dairy" in input_test.lower(),"that",menu,'contains',"dairy")
print('It is',"nuts" in input_test.lower(),"that",menu,'contains',"nuts")
print('It is',"seafood" in input_test.lower(),"that",menu,'contains',"seafood")
print('It is',"chocolate" in input_test.lower(),"that",menu,'contains',"chocolate")
Output
enter food categories eaten in the last 24 hours: meat, seafood, nutS
It is False that "seafood, dairy, nuts, chocolate" contains dairy
It is True that "seafood, dairy, nuts, chocolate" contains nuts
It is True that "seafood, dairy, nuts, chocolate" contains seafood
It is False that "seafood, dairy, nuts, chocolate" contains chocolate
I am trying to create an accurate output (below snapshot is not giving me what I need) when I trigger the user to type in the meals they had 24 hours ago like: meat, chocolate, dairy. The output should say False for meat and everything else true but I am not getting that - can someone help me?
Input
menu = '"seafood, dairy, nuts, chocolate"'
input_test = input("enter food categories eaten in the last 24 hours: ").lower()
print('It is',"dairy" in input_test.lower(),"that",menu,'contains',"dairy")
print('It is',"nuts" in input_test.lower(),"that",menu,'contains',"nuts")
print('It is',"seafood" in input_test.lower(),"that",menu,'contains',"seafood")
print('It is',"chocolate" in input_test.lower(),"that",menu,'contains',"chocolate")
Output
enter food categories eaten in the last 24 hours: meat, seafood, nutS
It is False that "seafood, dairy, nuts, chocolate" contains dairy
It is True that "seafood, dairy, nuts, chocolate" contains nuts
It is True that "seafood, dairy, nuts, chocolate" contains seafood
It is False that "seafood, dairy, nuts, chocolate" contains chocolate