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?
4 ответов
+ 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).
+ 13
Hy Trent Iuni
Might you posted same question 2 times , U can delete the duplicate https://www.sololearn.com/Discuss/1645657/?ref=app
+ 1
The simplest example: you need to check that one variable is NOT equal to another variable)
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.