What is a wanted a false statement to execute a task how would i go about that? Like if (2==3) Print(“hello”)
2/22/2018 10:35:39 PM
Sulaiman Bada4 Answers
New AnswerMaybe I'm miss-reading the question but, the condition isn't really false if you use the not operator. It is still true (NOT false). You would need to use an else statement to assure a different path is taken when the condition is false. if (2 == 3) print("Hello") else print("Not equal!") Output: Not equal! 2 == 3 is false, so the else statement executes which prints 'Not equal!'.
to decide weather true or false it should have condition like if not true: # becoze no condition not going to print print ("true 0") elif (2+2<5): #this will print becoze condition print("true 1") else: # this will not print becoze first elif was right print("true 2")
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message