Python if else
Python Condition al statements (If else) 1) if Syntax : if(condition) : s1 This is used to execute the mentioned statement s1 if the given condition is true and skip the execution of statement when the condition is false. Example: x=int(input()) if(x>0): print ("positive") Here if the input is greater than zero it will be printed as positive otherwise no output will be shown. 2) else Syntax : else : S1 Here S1 is the statement that is needed to be executed when if condition fails. Example: x=int(input ()) if(x>0): print ("positive") else: print ("negative") In this case all the other numbers which doesn't fall under if condition will be printed as negative. 3)elif(condition): This is used in case of multiple conditions. Example: x=int(input ()) if(x>0): print ("positive") elif(x<0): print ("negative") else: print ("zero") Here eli