How can you tell what the value of a variable is? One way is to print the value out to the console. To print the value of a variable, you first type the keywordprint, then the name of the variable between parentheses(). The full syntax is:
print (<variable>)
For example, we can check the value assigned to foo with the following code:
foo = "bar" print (foo)
The first line of code creates a variable named foo and assigns it the string value "bar". The second line prints the value of the foo variable. This means bar will be printed to the console:
Where does the print keyword come from? What's a keyword? Why do we use parentheses when using print? These questions will be answered in the Functions section of this chapter.