DAY 3
Today, you will get to know about conditional statements in python.
Conditional Statement is nothing but if-else statements.
format of the if-else statement:
if (condition):
print("--")
else:
print("--")
so the format will look like this.
now let's solve a problem :
Write a python program to check whether the number is odd or even number-
n=int(input("enter the number"))
if n%2==0:
print("The number is even number")
else:
print("The number is odd number")
output:
Write a python program to check whether the given number is greater than 10 or not, if yes then print, "The number is greater than 10", else print -"The number is less than 10"-
n=int(input("Enter your number"))
if n>10:
print("The number is greater than 10")
else:
print("The number is less than 10")
output:
These are the basic programs solved by the if-else statement.
In the next blog, you will get to know about the nested if-else statement.
Thank you.