Welcome So today here you are going to learn decision making in python ( if, elif, if-else, nested if statements in python). Decision-making statements in programming languages decides the direction of the flow of program execution. Decision-making statements available in python are if, elif, if-else, nested if. Decision making in python if Statement if statement is the most simple decision-making statement. It is used to decide whether a certain statement or block of statements will be executed or not i.e if a certain condition is true then a block of statement is executed otherwise not. Syntax : if condition: #Statements to execute Here, conditions after evaluation will be either true or false. if statement accepts boolean values – if the value is true then it will execute the block of statements below it otherwise not. We can use condition with bracket ‘( )’ also. Flowchart: Below we have given a small illustration
Comments
Post a Comment