i have data 11 attributes. want calculate distance on each of these attributes. example attribute (x1, x2, ..., x11) , x1 & x2 has nominal type, x3, x4, ... x10 has ordinal type, x11 has binary type. how can read attributes using python? , how differentiate these attributes in python , how differentiate these attributes in python can calculate distance? can tell me should do? thank you you can this: def distance(x,y): p = len(x) m = sum(map(lambda (a,b): 1 if == b else 0, zip(x,y))) return float(p-m)/p example: x1 = ("forestry", "plantation", "high", "low", "high", "medium", 3, "low", 297, 1, true) x2 = ("plantation", "plantation", "high", "medium", "low", "low", 1, "low", 298, 2, true) print distance(x1,x2) # result: 0.636363636364 = (11-4)/7