num = 3 if num !=1: print num if num ==3: print num + 1 if num ==4: print num else: print num-1 if num !=1 and num !=4: print "and "+str(num) if num !=3 or num ==3: print "or "+str(num) -------------------------------output--------------------- kondo@kondo-PC ~/python $ python if.py 3 4 2 and 3 or 3