Variables

A variable is a symbol that refers to an object, such as a string, integer, or list. Try these examples in the REPL:

>>> x = 5
>>> x
5
>>> x + 10
15
>>> y = "hello"
>>> y
'hello'
>>> y + " and goodbye"
'hello and goodbye'

Variables can be longer words as well:

>>> breakfast = ['ham', 'eggs', 'toast']
>>> breakfast
['ham', 'eggs', 'toast']
>>> type(breakfast)
<class 'list'>

Variables can have letters, numbers, and underscores, but should start with a letter.

results matching ""

    No results matching ""