1

I have been looking through some examples of code in python 3 and i have never seen anything like the ~ operator used before.

Here is the snippet of code:

array[i][~i] for i in range(0, 3) 

My first guess was it reverses like the value of i to start so on first iteration [i] would be 0 but [~i] would be 2 would i be correct in saying that?

Any explanations or documentation to read would be appreciated as i tried to look for information on it but couldn't find anything.

tDownUnder
  • 149
  • 6

0 Answers0