write syntax of if ,else ,elif statement
rogue0409:
Do you mean in python?
Answers
Answered by
4
Answer:
Syntax of if...else
The if..else statement evaluates test expression and will execute the body of if only when the test condition is True . If the condition is False , the body of else is executed. Indentation is used to separate the blocks.
Answered by
3
Answer:
lets take input from a user for an example. Also, this is in python-
number = int(input("Enter a number: "))
#this is the example of if elif and else statements
if number % 2 == 0:
print("This is an even number")
#elif statement now
elif number % 2 != 0:
print("this is an odd number")
else:
print("Invalid input")
#!= means is not equal to
% gives the remainder of a number divided
Similar questions