Python Statements

 RPA | Python Statements| Jupyter Notebook - Part-47


Python Statements - In this blog we will discuss about the various statements such as if, elif, else and also for loop and while loops in python using Jupyter Notebook. So let us look into each of the statements in detail one by one.

  • If Statement - The if statement one of the type of decision making statement which will be used to decide whether a certain set of statements or block of statements would be executed or not. If a certain condition is true then the block of statements under the if block will be executed otherwise these statements won't be executed if the condition is false. So let us look at the syntax of if statement which is as follows:
Python If Statement

When we are using if statement then the indentation matters the most as and when the indentation gets wrong the execution of the code will result in an error.

  • if else statement - The if else statement is used to determine whether an if block will be executed if the if condition is true otherwise the else block of code would be executed if the condition is false. So the syntax for if else statement would look something like this using Python which is as follows:
Python If-Else Statement

  • if-elif-else statement - The if-elif-else statement will determine which block of code needs to be executed depending upon the condition so the syntax would for if-elif-else statement would look something like this which is as follows:-
If-Elif-Else Python Statement

  • Nested If Statement - The Nested if statement contains an if within an if statement which will check which block of code needs to be executed depending upon which if condition results to true. So let us take a look at the syntax of nested if statement which is as shown below:
Nested If Statement


So with that we have come to the end of this blog where we discussed about the conditional statements in Python and how we can use these statements using Jupyter Notebook.

If you have any queries related to this article or blog then you can raise your queries in the comment section and I will be more than happy to answer all of your queries.

Lastly I would request all of you to please provide your feedback as the feedback that you provide really matters the most to me.

Comments

Post a Comment

If you have any doubts, please letme know.