t=(22,33,44,55,66,77,88,99) #A tuple is a sequence of immutable Python
print 'Tuple elements : ',t
#Accessing Values in Tuples
print 'Tuple first element :',t[0]
print 'tuple last element :',t[len(t)-1]
print '\n'
for i in t:
print 'Elements in tuple: ',i
print '\n'
for i in range(len(t)):
print 'Index :',i,'Vaule:',t[i]
No comments:
Post a Comment