If and Else Statements and code blocks Python .

Madiwa Simon
2 min readNov 15, 2021

blocks and statement conditions for Python.

For Python code blocks begins and end with indentations as for other languages we use {} brackets, parenthesis ()or other symbols

Python code is all about simplicity and cleanliness. It is almost like an english language made to be read easily and in proper order.

We can see that in the C language we are using a lot of brackets and indentations to establish a code block. In Python it is almost like an actual language with just extra spaces.

Now let’s talk about if and else statements in Python as you can see the indentations are only space tabs.

If the statements are true and valid the action will run Or if it is false then the else action will run.

In this code block of if statements. The first if statement is not valid since a is 10 and b is 11 that means it is not equal. It will go to the second if statement which is the elif which is valid because “a” and “c” are 10 so it will print out the sentence “second condition is true”. Now if none of the statements are true it will print out the else action.

--

--