Challenge: Using the Range Function
Compito
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.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 5. Capitolo 6
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione
Suggested prompts:
Riassuma questo capitolo
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 1.67
Challenge: Using the Range Function
Scorri per mostrare il menu
Compito
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.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Awesome!
Completion rate improved to 1.67Sezione 5. Capitolo 6
single