+ 1
If statment contains if statement ... Only the 1if statement is considered right?
It doesnt matter how many if statements are there inside if statement , only the 1statement is taken ?
6 Respostas
+ 2
That's because of the indentation.
Your code has returned True on the first query, so doesn't bother to read the rest of the indented code.
+ 6
Try running this code with adjusted indents
num = 7
if num > 3:
print("3")
if num < 5:
print("5")
if num == 7:
print("7")
+ 3
When I run the code, the output is
3
7
+ 1
For exmaple
num = 7
If num > 3:
Print("3")
If num < 5:
Print("5")
If num == 7
Print("7")
+ 1
Ans could b 3 and 7 or 7 right ... But the output is only 3 .. why?