if-elif-else in python
Useful for if-else kind of conditional execution when we have more than two related conditional statements.
Syntax :
if expression 1: # Executes when the boolean expression 1 is true elif expression 2: # Executes when the boolean expression 2 is true elif expression 3: # Executes when the boolean expression 3 is true else: # executes when the none of the above condition is true.
Block Diagram :

Example:
WAP to check whether a number is positive, negative or zero.#script.py n = 1 # Try these for these as well: # n = 0 # n = -4.5 if n > 0: print("Positive number") elif n == 0: print("Zero") else: print("Negative number")OUTPUT:
Positive number
Next topic is Nested-If in python
Training For College Campus
We offers college campus training for all streams like CS, IT, ECE, Mechanical, Civil etc. on different technologies
like
C, C++, Data Structure, Core Java, Advance Java, Struts Framework, Hibernate, Python, Android, Big-Data, Ebedded & Robotics etc.
Please mail your requirement at info@prowessapps.in
Projects For Students
Students can contact us for their projects on different technologies Core Java, Advance Java, Android etc.
Students can mail requirement at info@prowessapps.in