#Program to print the values and addres of the array elements.
arr=([[5,100],[10,200],[15,300],[20,400]])
for a in range(0,4):
print "Address of %d array= %u"%(a,id(arr[a]))
for b in range(0,2):
print "Value =%d"%(arr[a][b])
#Program to print the value and address of the element using array of pointers
a=[0,1,2]
b=10
c=20
d=30
a[0]=b
a[1]=c
a[2]=d
for i in range(0,3):
print "Address = %u"%id(a[i])
print "Value = %d" % (a[i])
#Program to sort a list of strings in alphabetical order using array of pointers.
a = []
n= input("Enter the number of strings: ")
print "Enter each string on a separate line below."
for i in range(0,n):
a.append(0)
for i in range(0,n):
a[i]=raw_input("String %d: " %(i+1))
for i in range(0,n):
for j in range(i,n):
if a[i]>a[j]:
t = a[i]
a[i] = a[j]
a[j] = t
print "\nReordered List of Strings: "
for i in range(0,n):
print "String %d: %s" %(i+1,a[i])
#Program to count number of words
str=[]
ps=raw_input("Enter a string: ")
print len(ps.split()), "word(s) in the given string"
#Program to demonstrate on strings and pointers
s1="abcd"
s2='efgh'
print "%s %16lu \n" % (s1,id(s1))
print "%s %16lu \n" % (s2,id(s2))
s1=s2
print "%s %16lu \n" % (s1,id(s1))
print "%s %16lu \n" % (s2,id(s2))