This platform is dedicated to providing comprehensive and accessible notes for BCA and BSc students. Stay tuned for regular updates and feel free to reach out with any questions or suggestions!
Thus, if-else statements must be nested to achieve multi-way selection.
Python, however, has another header called elif (“else-if”) that provides multi-way selection in a single if statement, shown in Figure.
All the headers of an if-elif statement are indented the same amount, thus avoiding the deeply nested levels of indentation with the use of if-else statements.
A final else clause may be used for “catch-all” situations.