1. 1

    When we start writing more complex programs, we’ll start working with more pieces of data. But data can get messy real fast if we’re not careful. To keep our data tidy, we’ll want to use _data st…

  2. 2

    Lists order items so that they’re in a specific sequence. For example the comic strip, as a list, stores frames in a specific order. Without an order, the story wouldn’t make sense! This idea of…

  3. 3

    After a list is created, we’re able to add things to it. When we add things to the end of an existing list, we say that we’re appending them to the end. Imagine we’re trying out different endi…

  4. 4

    We’re also able to remove items from a list. Similar to adding items, we can modify lists by taking off the last item, or we can use indexing to select a specific item and remove it from the list…

  5. 5

    Great! Now that you know all about lists, let’s write some code. There are many ways to create lists and they can change depending on what language you are programming in. For this exercise, we’l…

  6. 6

    Congratulations! Now you’ve learned about another data type known as a list. - A list is an ordered sequence of information - You can access an item in a list by using its index position - Yo…

  1. 1

    How do we use code to tell a computer this: “Create a variable and call a function 15 times”? We could write it out 15 times: […] …We’ll spare you the rest. This approach takes a long time …

  2. 2

    When we give instructions once and tell the computer how many times to repeat them, we are using a for loop, or a count-controlled loop. It executes a set of instructions for a specified numb…

  3. 3

    What if you approached tile-placing another way: you don’t know how many tiles to place, but you know when to stop. How could you communicate this type of command to a computer? Give it the instruc…

  4. 4

    There’s one more way to give looping instructions to a computer. We define a sequence of desired tile colors (a list), and tell the computer to repeat the instructions for each item in the sequen…

  5. 5

    Let’s combine all that we’ve learned so far: variables, operators, and data types functions and control flow * lists and loops Examples of for and while loops are provided below in JavaScript….

  6. 6

    Well done! Loops are commonly used in programming because they save time, reduce error, and are easy to read. Being comfortable with each type of loop will make you a better programmer. In review: …

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo