+ 1

How does not works in boolean function

5th Jan 2022, 5:41 PM
Sheriff Oladimeji
Sheriff  Oladimeji - avatar
4 Antworten
+ 3
the code will run when the condition is true: if True: print("Hello") # it will print if not(False): # it is also True print("hi") # it will print not is a logical operator that reverse the condition. 1 == 1 this condition is True because 1 is equals to 1, but when we use "not" operator it will become False. not(1 == 1) # this is False I don't know if I understood your question.
8th Jan 2022, 3:23 PM
Mafdi
Mafdi - avatar
+ 1
What about loops
8th Jan 2022, 5:43 PM
Sheriff Oladimeji
Sheriff  Oladimeji - avatar
+ 1
A loop keeps running as long as the condition is True. you can also use the "not operator" to reverse the condition of the loop.
8th Jan 2022, 7:50 PM
Mafdi
Mafdi - avatar
0
Mafdi Ok thanks
8th Jan 2022, 5:42 PM
Sheriff Oladimeji
Sheriff  Oladimeji - avatar