The if statement is the most basic of all the control flow statements. It tells your program to execute a certain section of code only if a particular test evaluates to true. The if statement is written with the if keyword.
Syntax :
if ( condition ) :
// body of the statements will execute if the condition is true
This program is a simple implementation of an "if-else" statement in Python to check whether a given number is even or odd.
The program checks if the given number is even or odd by checking if it's divisible by 2 (i.e. n % 2 == 0), and if it is, the program outputs the message "n is Even Number".
# IF Statement in Python n = int(input("Enter The Number : ")) if n % 2 == 0: print(n, " is Even Number")To download raw file Click Here
Enter The Number : 34 34 is Even Number
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions