#Program to print the value and address of the element
a=[10,20,30,40,50]
for b in range(0,5):
print "The value of a[%d]=%d"%(b,a[b])
print "Address of a[%d]=%u"%(b,id(a[b]))
#Program to print the value and the address of the element using pointer with function
a=[10,20,30,40,50]
for c in range(0,5):
print "The Value of a[%d]=%d"%(c,a[c])
print "The address of a[%d]=%u"%(c,id(b))
def value(b):
b=''
id(b)
#Program to add the sum of number using pointer
a=[10,20,30,40,50]
b=total=0
c=id(c)
for b in range(0,5):
print "Enter the number %d: "%(b+1)
a[b]=input()
c=a
for b in range(0,5):
total=total+c[b]
c[b]=c[b]+1
print "Total= %d"%(total)
#Program to sort a given number using pointer.
arr = []
n = input("Enter the no. of elements: ")
for i in range(0,n):
arr.append(0)
print "Enter the element: "
for i in range(0,n):
arr[i]=input()
print "Before Sorting:"
for i in range(0,n):
print "%d"%arr[i],
for i in range(0,n):
for j in range(i,n):
if arr[i]>arr[j]:
t = arr[i]
arr[i] = arr[j]
arr[j] = t
print "\nAfter Sorting:"
for i in range(0,n):
print "%d" %arr[i],