Decision making is required when we want to execute a code if a specific condition is satisfied. If else is used for Decision Making Syntax: if test expression: Code to be executed if condition in True . else: Code to be executed if condition in False. Here code will only be executed if the condition provided for IF statement is True. Else it will Run the code under the Else Statement Sample Example on If else: a = 10 if a == 10: print("The Number is 10") else: print("The Number is not 10") if else and elif flow chart: If elif else: elif if is short cut for else if. If the the first if condition is False it goes on to check next elif condition and so on. If all the conditions are false it will enter into else and execute the code inside else. Syntax: if test expression 1: Code to be exec...
A blog started by Rushi Mahapure