Posts

Showing posts with the label if(): elif
Three values a, b and c are entered from the keyboard. The program shows several variables for setting the minimum and maximum value. The PYTHON program is: # Minimum and Maximum element choice between a, b, c a = input('First number:') b = input('Second number:') c = input('Third number:') minim = a if (minim > b):     minim = b if (minim > c):     minim = c print('Minimum from a, b,  c is:', minim) if(a < b):     if(a < c):         minim = a     else:         minim = c elif (b < c):     minim = b else:     minim = c print('Minimum from a, b,  c is:', minim) minim = a if (a < b) else b minim = minim if (minim < c) else c print('Minimum from a, b,  c is:', minim) minim = (a if(a<c) else c) if(a<b) else (b if(b<c) else c) print('Minimum from a, b,  c is:', minim) # Alegere element maxim dintre a, b, c maxim = a if (maxim < b): ...