To access the value of a variable within the Python shell, simply type it.
>>> x = 1500
>>> x
1500
Within a program, one can use the 'print' command.
cat = 'dog'
print cat
output:
dogIf the variable is a string, you can also access its parts. Each character of the string is indexed, starting with the first character at '0'. By accessing the string with an indexing operator, you can access only part of the string and leave the rest untouched. An example:
cat = 'dog' print cat[0] print cat[1] print cat[2]output:
d
o
g
