Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Python: Find the minimum and the maximum of a tuple

T1 = ("z","b", "c", "d")
T2 = (8,2, 3, 4)
print T1, " Min T1= ",min(T1)
print T2, " Min T2= ",min(T2)
print T1, " Max T1= ",max(T1)
print T2, " Max

Python: Create a new dictionary object

# build a dictionary from a liste and a tuple
dict1= dict([('font', 12), ('size', 12)])
print dict
# build a dictionary from an expression
dict2= d

Python: Convert list to Tuple

liste= [1, 2, 3]
tple=tuple(liste)
print liste
print tple

Python: Create a list inside a tuple

T = (1, [2, 3], 4)
print type(T)
print len(T)
T[1][0] = 'python.tubedir.com'
print T
print T[1]