<jupyter_start><jupyter_text>VariablesYou can come up with a name and ask the computer to store a number in it.  You can then use this name in computations.  This has several advantages in understanding the computation and reducing the opportunity for errors.  Why use variables?One important benefit of using more advanced computing tools is that we can refer to numbers by a name that helps us understand the meaning of each number we are using and the intent of the calculation.Look at this calculation much like you would enter it on a calculator.  It is very clear that you are multiplying the number 30 by the number 50 but there is no indication of why you are doing that.<jupyter_code>30.0 * 50.0<jupyter_output><empty_output><jupyter_text>Using variablesHere, we add variables.  Now you can use these names to create the calculation.  While the intention isn't yet totally clear here, the reader can see at least that these two numbers are related to the dimensions of some shape.One added benefit, is that you can update the numbers if you need to and repeat the calculation.   The equals signIn this context, the equals sign instructs the computer to place whatever is on the right hand side of the equals into a box with the label on the left-hand side of the equals sign.  This will be different than your experience with calculators and some other programs (Calca) where you often place an equals sign after a series of operations.If you are having problems, it is likely that the computer cannot determine how to label your "box" that you would like to store a number in.<jupyter_code>length = 30.0
width = 50.0
length * width<jupyter_output><empty_output><jupyter_text>Examining the value of a variableTo see the value of a variable, you can write it on a single line in a cell and execute the cell.You can also use the command print (found in many languages) to output the value.  This has the advantage of being able to add other text.<jupyter_code>length
print(length)
print('the length is equal to', length)<jupyter_output>30.0
the length is equal to 30.0<jupyter_text>A little more about variablesThe computer can store many things besides numbers in a variable.  To understand what the value is you can ask the computer to tell you what type it is using the `type` command.  You are mostly using what the computer calls a `float` to represent a number.  To illustrate another type of data, you could have a small block of text in a variable.  When we start using more sophisticated functions, you will often see these blocks of text in quotes.```word = 'half'```If you are ever curious about what kind of data is stored in your variable, the `type` command is a useful tool.<jupyter_code>num = 0.5
num
type(num)
word = 'half'
word
type(word)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.04045828857858933, 'fraction_numerical': 0.008592910848549946, 'mean_word_length': 4.633064516129032, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '226694', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 712, 'n_tokens_neox': 687, 'n_words': 446, 'path': '3-variables.ipynb', 'repo_name': 'dsoto/computing-tutorial', 'size': '2793'}