2021年2月2日星期二

Python3 print([1, 2] and 3) == 3

I typed

print([1,2] and 3)  

and the result is

3  

.

How did this happen? why is the result 3.

I guess [1,2] is considered as True. But I don't know how the backend process worked.

https://stackoverflow.com/questions/66021022/python3-print1-2-and-3-3 February 03, 2021 at 11:52AM

没有评论:

发表评论