Thursday, January 18, 2018

Conditional statements in Python


The if-then construct (sometimes called if-then-else) is common across many programming languages, but the syntax varies from language to language.

The general form of the if statement in Python looks like this:

if condition_1:
    statement_block_1
elif condition_2:
    statement_block_2
else:
    statement_block_3



Examples



No comments:

Post a Comment