Posts

Showing posts with the label nested if else

Python Decision Making and Loops

DECISION MAKING: If Statement        An if statement consists of a boolean expression followed by one or more statements. if...else statement nested if else statement An if statement can be followed by an optional else statement , which executes when the boolean expression is FALSE. You can use one if or else if statement inside another if or else if statement(s). Ex: var = 100      #indentation is important if ( var ==100): print "Good bye!" Else: An else statement can be combined with an if statement. An else statement contains the block of code that executes if the conditional expression in the if statement resolves to 0 or a FALSE value. if expression: statement(s) else: statement(s) 2) a=10 if(a>10):               print("Value of a is greater")   else :   ...