Is the Double NOT Operator is just the same with Boolean()? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Is the Double NOT Operator is just the same with Boolean()?

Both outputs the same but are they exactly the same even if they used on other ways? https://code.sololearn.com/W0UIIuVyDRHO/?ref=app

24th Jun 2019, 6:07 AM
Nootnoot
Nootnoot - avatar
3 Answers
+ 1
I think you are right. But for runspeed, in Python I found, that using (not not x) is about 5 times faster than using bool(x), and about 1/4 faster than using x != 0.
24th Jun 2019, 7:48 AM
Seb TheS
Seb TheS - avatar
+ 1
Okay, I get it now. Thanks Seb TheS 🙂
24th Jun 2019, 8:17 AM
Nootnoot
Nootnoot - avatar
+ 1
Yeah it is same as the Boolean
7th Aug 2019, 2:03 PM
Nithish Nithish
Nithish Nithish - avatar