The coding in this course will be done in Jupyter Notebooks. Follow these steps to create your first Jupyter Notebook. Variables are like boxes; they hold important information, or data. A variable can hold different data types, such as numbers or words.
Think of a chest. You can store items inside it, and give the chest a name to help you remember what you put in there.
In this case, you'll store some doughnuts in the chest. If you want to remember how many doughnuts you put in the chest, you could name it:
number_of_doughnuts
The chest's name is the variable's name!
Note: When you're writing the name of a variable in Python, it should always be lowercase, with words separated by an underscore. After naming a variable, you can give it a value, which is like filling the chest. This is called initializing.
Say you have three doughnuts in your chest. You'd initialize your chest variable by setting it equal to three:
number_of_doughnuts = 3
To see the value of your variable when you run your program, you'll need to print it.
Type:
number_of_doughnuts = 3
print("number_of_doughnuts is " + number_of_doughnuts"!")
Variables can hold data besides numbers, including words. Programmers refer to variables holding words as strings.
doughnut_name = "Kepler" print(doughnut_name)These characters can be used to help format string output.
\n- new line\t- tab\"- quotation
\n characters with this option!
my_multiple_line_string = """This is the first line This is the second line This is the third line"""You can also use variables to show if something is true or false; this type of data is called a boolean.
Create a variable to determine if these doughnuts exist.
Add the following to your program and then run it:
doughnuts_exist = True print(doughnuts_exist)To set it to not true, change the variable to:
doughnuts_exist = FalseUse variables to store different types of data to use later in your program. Types of data:
number_variable = 5
string_variable = "value"
boolean_variable = True



