Key Concepts

Review core concepts you need to learn to master this subject

Comments

# Comment on a single line user = "JDoe" # Comment after code

A comment is a piece of text within a program that is not executed. It can be used to provide additional information to aid in understanding the code.

The # character is used to start a comment and it continues until the end of the line.

Variables
Lesson 1 of 4
  1. 1
    In programming, we have a way of storing values so that we can reuse them throughout our program or change them, if necessary. This concept is known as a variable. Maybe you’re familiar with th…
  2. 2
    One reason we use variables is that they allow us to easily reuse values in different parts of our code. When we reuse a value, it will appear in multiple places in our code. Re-typing that val…
  3. 3
    The strong selling point of using a variable is that we can easily change their value, making our programs flexible. As we saw in the last exercise, we can save a number to a variable and reuse i…
  4. 4
    Now that you know a bit about variables, let’s code some ourselves! We create or declare a variable by giving it a name and setting it equal to a value. terrain = ‘lake’ In the code editor,…
  5. 5
    Congrats! Now you’ve learned about variables and why they’re useful in programming. In this lesson, we learned that: - Variables allow us to store information - Variables allow us to quickly _re…