else
statement :# Using the else statement
x = -3
if x > 0:
print("x is positive")
else:
print("x is not positive")
x is not positive
if
` statement to check the value of the variable `x
`. If `x
` is greater than `0
`, the program will execute the code in the `if
` block, which prints the message "x is positive
". x
` is not greater than `0
`, the program will execute the code in the `else
` block, which prints the message "x is not positive
".else
` statement to perform an action when the initial condition in the `if
` statement is false. This allows you to have an alternative action to take when a condition is not met.