Python does not specify data types when defining variables (unlike Java)
Example 1:>>a=10
>>print type (a) # Print types
<type ' int ' > # can automatically recognize data types (for numbers, identify numeric type int)
Example 2:>>b= ' Love '
>>print type (b)
<type ' str ' > # identification data type str
A Python object contains three basic elements: ID (Identity), type (data type), value
Example:>> a=10
>>print ID (a) # Print ID
32145040 # This ID is a random identification of python assigned to a
type- data type:
Number numbers
number types: int, long, float, complex
String strings
Consists of numbers, letters, underscores
List lists
Example: [' John ', 80,70.2]
Tuple tuples
strings or numbers enclosed in parentheses, read-only, cannot be assigned two times (constants in Java once assigned, cannot be changed while the program is running)
Example: (' Lily ', 2.2,90)
Dictionary Dictionary (Key/value)
Example: {' name ': ' Lucy ', ' Code ': 8080}
Python object, data type summary