Mega Code Archive

 
Categories / Python Tutorial / Introduction
 

Python is dynamically typed, no pre-declaration of a variable or its type is necessary

# 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)