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).
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 3. Kapitel 7
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Suggested prompts:
Ställ mig frågor om detta ämne
Sammanfatta detta kapitel
Visa verkliga exempel
Awesome!
Completion rate improved to 2.7
For Loop
Svep för att visa menyn
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).
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 3. Kapitel 7