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
Trent Iuni - avatar
4 Respostas
+ 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
Gaurav Agrawal - avatar
+ 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
Gaurav Agrawal - avatar
+ 1
The simplest example: you need to check that one variable is NOT equal to another variable)
4th Jan 2019, 5:36 PM
Игорь Яковенко
Игорь Яковенко - avatar
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
HonFu - avatar