In what instance is the "not" operator to be used? | Sololearn: Learn to code for FREE!
0

# In what instance is the "not" operator to be used?

Specifically asking why would you want the inverse of a Boolean? What is it's practical purpose?

4th Jan 2019, 5:20 PM
Trent Iuni
+ 14
basic example : ā suppose you want to take print numbers in range 1 to 100 which are not divisible by 3, the condition you will be putting will be (n%3)!=0 OR !(n%3==0).
4th Jan 2019, 5:48 PM
Gaurav Agrawal
+ 13
Hy Trent Iuni Might you posted same question 2 times , U can delete the duplicate https://www.sololearn.com/Discuss/1645657/?ref=app
4th Jan 2019, 5:22 PM
Gaurav Agrawal
+ 1
The simplest example: you need to check that one variable is NOT equal to another variable)
4th Jan 2019, 5:36 PM
ŠŠ³Š¾ŃŃ ŠÆŠŗŠ¾Š²ŠµŠ½ŠŗŠ¾
0
In cases of equality you rather would write != instead of not. But generally you can turn around every boolean with not not True -> False not x -> x == zero not arr -> arr is empty Things like that.
4th Jan 2019, 5:50 PM
HonFu