Learn

Inside a while loop, you can do anything you could do elsewhere, including arithmetic operations.

Instructions

1.

Create a while loop that prints out all the numbers from 1 to 10 squared (1, 4, 9, 16, … , 100), each on their own line.

  • Fill in the blank space so that our while loop goes from 1 to 10 inclusive.
  • Inside the loop, print the value of num squared. The syntax for squaring a number is num ** 2.
  • Increment num.

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?