One Pager Cheat Sheet
- This lesson will discuss variables and assignment of data values in Python for storing data temporarily.
- Variables are
placeholdersfor data values that can be assigned using theassignment operator(=) and re-assigned when needed. - Python can create variables directly by providing a name and assigning it a value, as shown in the code blocks, and then use the
print()or variable name to display the stored value. - We need to be careful to follow the specific syntax rules when creating variables, or they may not be created correctly and cause errors.
- Creating a variable in Python is done by having a variable name followed by an
assignment operator(=) and a value, as is the case with the code snippetwords = "Hello World!", which is a valid way to declare the variablewords. - Yes, using an underscore (_) is a valid way to name variables in Python.
- Variables can be
reassignedin Python, replacing theirprevious valuewith anewer one. - We can perform different operations on each type of variable, such as mathematical operations on integers or
concatenationof strings. - The final value of
ais "World". - The program prints the result of concatenating the values in the
first_nameandlast_namevariables, which isAnnaGreen. - Creating meaningful variable names is
keyto being able to keep track of values stored in a program.



