Home > Software design >  when I run this code below, it doesn’t give me True or False
when I run this code below, it doesn’t give me True or False

Time:06-12

it doesn’t give an output and I Know that the output should be True or False

some = [1, 9, 21, 3]
9 in some

CodePudding user response:

As others have pointed out, you need to do something with the result. You can save it into a variable with:

var = 9 in some

or print it directly with:

print(9 in some)

CodePudding user response:

It does return a TRUE/FALSE:

[In]: 3 in list([1,2,35])
[Out]: False 

[In]: 3 in list([1,2,3,5])
[Out]: True 
  • Related