For Loop
We use loops if we want to repeat any action n-times.
1234prices = [100, 458, 231, 378] for i in prices: print(i, end = '')
12345# Decreasing prices by 1 prices = [3, 5, 6, 2, 7, 8] for i in prices: print(i, end = ' ')
end = ' '
means that the result will be written in one row (not column).
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 7
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Suggested prompts:
Still meg spørsmål om dette emnet
Oppsummer dette kapittelet
Vis eksempler fra virkeligheten
Awesome!
Completion rate improved to 2.7
For Loop
Sveip for å vise menyen
We use loops if we want to repeat any action n-times.
1234prices = [100, 458, 231, 378] for i in prices: print(i, end = '')
12345# Decreasing prices by 1 prices = [3, 5, 6, 2, 7, 8] for i in prices: print(i, end = ' ')
end = ' '
means that the result will be written in one row (not column).
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 7