Answer:
Step-by-step explanation:
1. Difference between if and if...else statement:
The if statement is used for conditional execution of a block of code. It checks a specified condition and executes the block of code only if the condition is true.
The if...else statement, on the other hand, provides an alternative block of code to be executed when the condition specified in the if statement is false. So, it handles both the true and false conditions.
2. Flowchart for the elif statement:
The elif statement is used in Python to add more conditions to the if...else statement. It stands for "else if" and allows you to check multiple conditions sequentially. Here's a textual description of a flowchart for elif
3. Explanation of while loop with an example:
The while loop is used to repeatedly execute a block of code as long as the specified condition is true. The loop continues until the condition becomes false.
4. Condition for an infinite while loop:
An infinite while loop occurs when the loop condition always evaluates to true, and there is no mechanism to break out of the loop.
5. Description of for loop with an example:
The for loop is used to iterate over a sequence (such as a list, tuple, string, etc.) and execute a block of code for each element in the sequence. Here's an example:
fruits = ["apple", "banana", "orange"]
for fruit in fruits:
print(f"I like {fruit}s")