Learn

If your list is a jumbled mess, you may need to sort() it.

animals = ["cat", "ant", "bat"] animals.sort() for animal in animals: print animal
  1. First, we create a list called animals with three strings. The strings are not in alphabetical order.
  2. Then, we sort animals into alphabetical order. Note that .sort() modifies the list rather than returning a new list.
  3. Then, for each item in animals, we print that item out as "ant", "bat", "cat" on their own line each.

Instructions

1.

Write a for-loop that iterates over start_list and .append()s each number squared (x ** 2) to square_list.

Then sort square_list!

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?