I'm beginner in Python. I wrote the code like as below just for practice.. Please look on it
i=1
def wrte():
global i
while i<5:
print "%s .Line..\n" %i
i+=1
def appnd():
j=i
while i in range(i,j+3):
print "%s .Line..\n" %i
i+=1
def Main():
wrte()
appnd()
Main()
Output is like as below
1 .Line..
2 .Line..
3 .Line..
4 .Line..
**Traceback (most recent call last):
Line 18, in <module>
Main()
Line 16, in Main
appnd()
Line 9, in appnd
j=i
UnboundLocalError: local variable 'i' referenced before assignment**
Expected Result:: The next sequence is should be appended like
5. Line..
6. Line..
7. Line..
Please help me on this..
wrte, think about what you are doing in that to make it work...