0
if statement doubt
num = 7 if num > 3: print("3") if num < 5: print("5") if num ==7: print("7") in q&a part this one ur answer is 3 but 7 also will come na
2 odpowiedzi
+ 2
num > 3 returns true
print("3")
num < 5 returns false
if num == 7 is not executed because this if statement belongs to if num < 5
So the output should be only 3
+ 1
The first 'if' statement is true, so primarily the output will be 3.
But the second 'if' statement is false, hence all the statement under this second statement is false and will not be operated.
So the final output will be only 3