defdef minsteTall(a,b):
if a < b:
return a
elif b < a:
return b
else:
return a;
def minsteAvTreTall(a,b,c):
if a < b &&and a < c:
return a
elif b < a &&and b < c:
return b
elif c < a &&and c < b:
return c
else:
if a == b:
return a
elif a == c:
return a
elif b == c:
return b
#Om vi kommer ned hit betyr det at alle tallene er like
else:
return a
#En bedre løsning som benytter en liste
def minsteAvTreTallList(a,b,c):
liste = [a,b,c]
minste = a
for tall in liste:
if tall < minste:
minste = tall
return minste |