Answer:
a. Comparison of if-else and elif:
if else follow as:
If (Condition)
{
In case if condition true, expression in this section executes
}
else
{
In case condition is false, expression in this section executes
}
elif Statement follows as:
If (Condition)
{
In case if condition true, expression in this section executes
}
{
in case, condition is false, move to elif block
elif (Condition)
{
In case elif condition true, expression in this section executes
}
else
{
In case elif condition is false, expression in this section executes
}
}
Explanation:
In if else, program first check the condition in "if statement", if condition is true it move into the body of "if " and execute the expression. If the condition is false it moves to the body of "else" and execute the expression.
elif is another block of condition in If else condition,It works as in "if statement" if the condition is true the program executes the expression of body of "if body". If the condition is false, it moves to another block of "elif", where it again check some other condition found in "elif statement". If the condition of "elif statement" is true it executes the expression of "elif body" otherwise in case of false condition it execute the expression in "else body".
It follows as: if - elif-else
Answer
b. the relational operators
Relation operators are the operators that are need in the expression to establish relationship between different operands of the expression.
Explanation:
In few expressions, their are some operators used to establish or show the relationship between different operands. These operator could be Equal (=), Greater than(>), Less than (<), Greater than equal to (>=) and Less than Equal to (<=).
These operators can be used in conditional statements that are used to check the relationship between operands and values through these operators.
Example
if (a>5)
{
if value of is greater than 5 then body of if will execute.
}
else
{
If value of a is less or equal to 5, this section will execute.
}