top of page
Writer's pictureRajesh Singh

Nested If else statement in Python

Updated: May 25, 2021


If statement is within another if statement then this is called nested of control statements.

Example

num = -100

if num > 0:

print("Positive Number")

else:

print("Negative Number")

if -100<=num:

print("Three digit Negative Number")


Output:

Negative Number

Three digit Negative Number

Nested If else program video:





Recent Posts

See All

For Loop MCQs in Python

Q1. What is the output of the following Python code? x={1:"X",2:"Y",3:"Z"} for i,j in x.items():     print(i,j,end=" ") A.    1 X 2 Y 3 Z...

Comments


bottom of page