+ 1
Can i create a logical operator that says true when something is logically right like:
If i have bread and there is a specific place that i store bread but for some reason it's stored on a "counter" and not on the specific place then everytime i ask if the bread is in the specific place the answer would be true but if it's not there and it's on the counter the code will say false. -->Let's name the specific place a "cabinet" : I am just curious to know
3 Answers
+ 3
counter = []
cabinet = ['bread']
if 'bread' in cabinet:
print('I\'ll get it for you!')
elif 'bread' in counter:
print('Here you are!')
else:
print('Sorry, we\'re out of bread.')
+ 3
Yes. Just frame condition properly to get correct result
Your description has some confusing as @Slick asked..
How your are going determine where it is..?
It is upto how you frame it..
I use variables to store info:
if bread_placed == "cabinet" :
return true
else :
return false
+ 1
How can the bread be on the counter if its not there?