0

I accidentally ran following statement [10] and [(3, True)] and it gave back a result [(3, True). As far as my understanding goes, this should have returned True because neither of the list is empty but to my surprise it didn't. Can someone help me understand this concept?

Thanks!

petezurich
  • 9,280
  • 9
  • 43
  • 57
Slayer
  • 832
  • 1
  • 6
  • 21
  • Note: please always use the generic [python] tag for all python related questions. – juanpa.arrivillaga May 31 '19 at 20:17
  • @juanpa.arrivillaga Yes, and thanks for the link, I understood why it does so. It returns the result of the condition. I tried with `[] and [(1,False)]` and it resulted in `[]` which made me understand that the condition itself is returned. – Slayer May 31 '19 at 20:20
  • @Prerit, check out this link, I think it answers your question quite well: https://stackoverflow.com/a/47007761/7087509. If you want to have a True/False value you need to explicitly cast it `bool([10] and [(3, True)])` – losik123 May 31 '19 at 20:25

0 Answers0