+ 2

Can someone explain to me what is mean? x in x

Help me I did not understand why he gave me false Python Code is: x=[1,3,5] print(x in x)

1st Aug 2020, 11:39 AM
Ahmad Fijr
Ahmad Fijr - avatar
3 Answers
+ 2
Because x is an array and with x in x you Check for an array in an array but x only has numbers as elements
1st Aug 2020, 11:46 AM
Jnn
Jnn - avatar
+ 1
If you use: for i in x: print (i in x) It would be true i guess
1st Aug 2020, 11:47 AM
Jnn
Jnn - avatar
+ 1
Ok thank you Jnn
1st Aug 2020, 11:52 AM
Ahmad Fijr
Ahmad Fijr - avatar