# Prøv å komme fram til svaret selv før dere kjører programmet #----------Oppgave 1a---------- tall = 1 + 2 + 3 tall = tall * 2 - 1 print(tall) #----------Oppgave 1b---------- tall = 4 * 2 t1 = "a" if tall > 9: t1 = t1 + "a" tekst = "b" + t1 print(tekst) #----------Oppgave 1c---------- if (5 > 7) or (2 > 1): print("ja") else: print("nei") #----------Oppgave 1d---------- liste = [1, 2, -3, 4, -5, 6] total = 0 i = 0 while liste[i] > 0: total += liste[i] i += 1 i = len(liste) - 1 while liste[i] > 0: total += liste[i] i -= 1 print(total) #----------Oppgave 1e---------- a = 3 while a < 25: a = a * 2 for b in [1, 2, 3]: a += b print(a) #----------Oppgave 1f---------- tall = 0 operasjoner = "idd.d..did" for operasjon in operasjoner: if operasjon == "d": tall = tall*2 elif operasjon == "i": tall = tall+1 else: tall = 0 print(tall) #----------Oppgave 1g---------- bok = {"a": [3, 4, 5], "b": [6, 7]} bok["a"].append(8) print(len(bok["a"]))