Tuples:

T = (1, 2, 3, 4)
len(T)

T + (5, 6)

T.index(4)
T.count(4)

#Tuples are immutable

 

Sets:

T = (1, 2, 3, 4)
len(T)

T + (5, 6)

T.index(4)
T.count(4)

#Tuples are immutable

 

 

Fractions:

from fractions import Fraction
f = Fraction(2, 3)
f+1
f + Fraction(1, 2)

 

 

Types:

L = [2, 3, 4]
type(L)	#<class 'list'> for 3.0 or higher

isinstance(L, list)	#True
posted on 2011-10-28 17:27  Aeol Kong  阅读(200)  评论(0)    收藏  举报