Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Working with the While Loop | Loops in Python
Introduction to Python(ihor)

Svep för att visa menyn

book
Challenge: Working with the While Loop

Uppgift

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 number a to the power of b.
  • 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 of i (i raised to the power of 2) into the squares list using the .append() method.
  • Increment i by 1 to continue iterating through the loop.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 5. Kapitel 2
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

close

Awesome!

Completion rate improved to 1.67

book
Challenge: Working with the While Loop

Uppgift

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 number a to the power of b.
  • 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 of i (i raised to the power of 2) into the squares list using the .append() method.
  • Increment i by 1 to continue iterating through the loop.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

close

Awesome!

Completion rate improved to 1.67

Svep för att visa menyn

some-alt