pythonlistsyntaxoperation

Comparison Operation of List Data Structure on Python


Assuming that I have a List data strecture: list. And I see one code: list[:,0]>5 I don't know what it means? But I know what list[:,0] means.

I google it and read many in python.org but I can't acquire appropriate answer.


Solution

  • I realized it's a very simple thing:

    list > 5 compares every elements of list with 5, if it is larger than 5 the result is True, else False. So if

    list=[1,2,6]
    list > 5
    # -> [False, False, True].