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).
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 7
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Ask me questions about this topic
Summarize this chapter
Show real-world examples
Awesome!
Completion rate improved to 2.7
For Loop
Swipe to show menu
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).
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 7