Challenge: Using the Range Function
Task
Swipe to start coding
You are creating a list of numbers with specific conditions. Your goal is to store the numbers from 1 to 9 (including 9) in a list called result
.
- Use a
for
loop and therange
function to generate numbers from 1 to 9. - If the number is even, square it before adding it to the list.
- To check if a number is even, use an
if
statement with the conditioni % 2 == 0
. - Add each processed number to the
result
list.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 5. ChapterΒ 6
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Summarize this chapter
Explain the code in file
Explain why file doesn't solve the task
Awesome!
Completion rate improved to 1.67
Challenge: Using the Range Function
Swipe to show menu
Task
Swipe to start coding
You are creating a list of numbers with specific conditions. Your goal is to store the numbers from 1 to 9 (including 9) in a list called result
.
- Use a
for
loop and therange
function to generate numbers from 1 to 9. - If the number is even, square it before adding it to the list.
- To check if a number is even, use an
if
statement with the conditioni % 2 == 0
. - Add each processed number to the
result
list.
Solution
Everything was clear?
Thanks for your feedback!
Awesome!
Completion rate improved to 1.67SectionΒ 5. ChapterΒ 6
single