# The type and value are initialized on assignment. # Assignments are performed using the equal sign. counter = 0 miles = 1000.0 name = 'Bob' counter = counter + 1 kilometers = 1.609 * miles print '%f miles is the same as %f km' % (miles, kilometers)
1.5.variable | ||||
1.5.1. | A variable is basically a name that represents some value | |||
1.5.2. | Sequence Unpacking | |||
1.5.3. | A literal is a number or string that appears directly in a program. | |||
1.5.4. | Python is dynamically typed, no pre-declaration of a variable or its type is necessary. | |||
1.5.5. | Once a variable has been assigned, you can access it by using its name | |||
1.5.6. | None placeholder |