Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Working with the While Loop | Loops in Python
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to Python (dev copy)

bookChallenge: Working with the While Loop

Opgave

Swipe to start coding

  1. Create a variable named i and set it to 1.

  2. Begin a while loop that runs for numbers from 1 to 9 (inclusive). Inside the loop, do the following:

    • Print the square of i;
    • Increment i by 1.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 5. Kapitel 2
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

Suggested prompts:

Opsummér dette kapitel

Explain code

Explain why doesn't solve task

close

bookChallenge: Working with the While Loop

Stryg for at vise menuen

Opgave

Swipe to start coding

  1. Create a variable named i and set it to 1.

  2. Begin a while loop that runs for numbers from 1 to 9 (inclusive). Inside the loop, do the following:

    • Print the square of i;
    • Increment i by 1.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 5. Kapitel 2
single

single

some-alt