Challenge: Working with the While Loop
Tehtävä
Swipe to start coding
You are given the variable i
for iterating through the list and the list squares
, which should store the squares of numbers from 1 to 10.
- Use
a**b
to raise the numbera
to the power ofb
. - Assign the value 1 to the variable
i
in order to start the iteration. - Create a
while
loop that will iterate through the numbers from 1 to 10, inclusive. - Inside the
while
loop, write the square ofi
(i
raised to the power of 2) into thesquares
list using the.append()
method. - Increment
i
by 1 to continue iterating through the loop.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 5. Luku 2
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Awesome!
Completion rate improved to 1.67
Challenge: Working with the While Loop
Pyyhkäise näyttääksesi valikon
Tehtävä
Swipe to start coding
You are given the variable i
for iterating through the list and the list squares
, which should store the squares of numbers from 1 to 10.
- Use
a**b
to raise the numbera
to the power ofb
. - Assign the value 1 to the variable
i
in order to start the iteration. - Create a
while
loop that will iterate through the numbers from 1 to 10, inclusive. - Inside the
while
loop, write the square ofi
(i
raised to the power of 2) into thesquares
list using the.append()
method. - Increment
i
by 1 to continue iterating through the loop.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Awesome!
Completion rate improved to 1.67Osio 5. Luku 2
single