# Eksempel p? prosedyre med parameter - skrivUtSum(a, b) def skrivUtSum(a, b): sum = a + b print(sum) skrivUtSum(2, 8) # Eksempel p? funksjon med parameter - summer(a, b) def summer(a, b): sum = a + b return sum # Lagre verdien fra funksjonen over sum = summer(2, 3) # L?sningsforslag oppgave 1 def returnerStorste(tall1, tall2): if tall1 > tall2: return tall1 return tall2 storsteTall = returnerStorste(10, 5) # L?sningsforslag oppgave 2 # Alternativ 1 innfil = open("historie.txt", "r") historie_liste = [] linje = innfil.readline() while linje != "": historie_liste.append(linje) linje = innfil.readline() innfil.close() print(historie_liste) # Alternativ 2 innfil = open("historie.txt", "r") historie_liste = [] for linje in innfil: historie_liste.append(linje) innfil.close() print(historie_liste) # L?sningsforslag oppgave 3 def is_true(a, b): if a and b: return 1 if not a and not b: return 0 return -1