mardi 27 juillet 2021

What does this if statement do (list)? [duplicate]

I am reading a code and there is a list and an if statement, for example:

x, y = map(int, input().split())
ret = a[x][y]
    a[x][y] = 0
    for i in range(8):
        nx = x + [-2, -2, -1, -1, 1, 1, 2, 2][i]
        ny = y + [-1, 1, -2, 2, -2, 2, -1, 1][i]
    
        if a[nx][ny]:
            ret += dfs(nx, ny)

What does the last if statement do? This is my first time seeing an if without a condition like >, <, ==.

Aucun commentaire:

Enregistrer un commentaire