CBSE Class 10 Computer Applications
Question 12 of 26
Python Conditionals and Loops — Question 3
Back to all questions 3
Question Question 3
Differentiate between if and if-else statements.
Difference between if and if-else statements in Python:
| S. No. | if | if-else |
|---|---|---|
| 1. | if statement allows us to execute a code block when the condition is True. | if-else statement allows us to execute different code blocks based on whether the condition is True or False. |
| 2. | if statement does nothing in case condition evaluates to False. | if-else statement executes the statements indented below else when the condition is False. |