You get i, but you do not assign it the return value from the instruction yield. If you assign a return value, you will see the expected result:
def z(n):
print 'Generator started'
i=0
while(i<n):
val=yield i
print "value is:",val
if val is not None:
i = val
i+=1
z1=z(10)
print 'Before start'
print z1.next()
print z1.send(5)
print z1.next()
Conclusion:
Before start
Generator started
0
value is: 5
6
value is: None
7
: send next , yield, . value is: . send next , yield. send , yield, yield None.