python if statement
If statement
Here, the program assesses the test articulation and will execute statement(s) just if the test articulation is True.
On the off chance that the test articulation is False, the statement(s) isn't executed.
In Python, the body of the if explanation is demonstrated by the space. The body begins with a space and the first unindented line denotes the end.
Python deciphers non-zero qualities as True. None and 0 are deciphered as False.
# If the number is certain, we print a proper message
output;
10 is a positive number.
This is constantly printed.
This is likewise consistently printed.
In the above model, num > 0 is the test articulation.
The assemblage of if is executed just if this assesses to True.
At the point when the variable num is equivalent to 10, test articulation is valid and explanations inside the collection of if are executed.
In the event that the variable num is equivalent to - 1, test articulation is bogus and explanations inside the group of if are skipped.
The print() articulation falls outside of the if square (unindented). Subsequently, it is executed paying little heed to the test articulation.
No comments