Python IF
IF statement
IF statement – with the IF statement you can use optional parts like elif or else. The keyword elif is short for else if keyword.
Examples
>>> c = 10 >>> if c < 0: print('Negative value') elif c <= 10: print('Value in range') else: print('Value exceeded') Value in range >>>
>>> a = int(input("Enter a value: ")) Enter a value: 5 >>> if a < 5: a=-1 print('Value is less than a value') elif a == 5: print('Match') else: print('Value is greater than a value') Match >>>