+ 2

Tell me the meaning please!

What's the meaning of " ~ " symbol in python? Actually i just wrote it as - print(~~~2017+1) output- -2017 Huh! I don't know its meaning, will someone help?

24th Apr 2021, 6:37 AM
Rosy
Rosy - avatar
1 Respuesta
+ 5
The tilde ~ is a bitwise complement or bitwise not operator. It does a logical negation flipping all of the bits. https://realpython.com/JUMP_LINK__&&__python__&&__JUMP_LINK-bitwise-operators/#bitwise-not
24th Apr 2021, 6:50 AM
ChaoticDawg
ChaoticDawg - avatar