Conditional Statements (if, elif, else)
Conditional Statements (if, elif, else)
Conditional statements allow your program to make decisions and execute different blocks of code based on whether a condition evaluates to True or False.
if: Evaluates a condition; runs if true.
elif (Else If): Checks an alternative condition if previous ones failed.
else: A catch-all safety net that runs if none of the preceding conditions are true.
Identation is very important
else is not a cumpulsory block, but it's good to haveĀ