# Order of controls and targets of cnx gates in Qiskit (Python)

In the following piece of code:

cnx(qwc, q[0], q[1],q[2],q[3])


in what order control qubits and target qubit are? Which qubit is inverted for which values of which ones?

As explained here, if all of q[0], q[1] and q[2] (the n-1 qubits) are 1, then q[3] (the n-th qubit) is inverted. That is, q[3] is the target qubit and the rest (q[0], q[1] and q[2]) are controls.