0
Why does this code show no output
num = 6 if num == 5: print("Bigger than 5") if num <=47: print("Between 5 and 47")
7 odpowiedzi
+ 5
The first condition is False, so the whole block below it (including the second "if condition") is not executed.
+ 1
I changed it to an elif so that the code would run even after a condition was no met and it works now thanks for helping me work through that much appreciated
0
You have given wrong indentation. Second block of if statement is indented wrong. It will be outside of first if block
0
Could it be that == is not a valid function for solely if statements and bi should run this as an 'elif' statement instead?
0
== is valid. I have checked it only problem is of indentation.
0
Are you checking in this apps playground or in actual python?
0
Apps playground