Sorry.. I am new to this forum. I tried to find solution from older threads but couldn't. Here I am starting a new thread.
My doubt is that suppose i want to do one looping process to assign values, how I have to do.
For example:
Having one list like L1 =
need to do pop operation and assign value like,
z1 = L1.pop()
z2 = L2.pop()
z3 = L3.pop()
...
similarly upto length of the list. Please give a solution.

Member Avatar for sravan953

To assign values:

loop=[]

#Depending on number of values you want to assign, specify the limit(here 5 values)

a=0
while a<=5:
    loop.append(a)
    a+=1

To pop values:

a=len(loop)

p=0
while p<=a:
    loop.pop(p)
    p+=1

I hope it works for you! :)

What do you want to accomplish?
Here is simple Looping. It prints what is poped

L1 = ["a", "b", "c", "d"]
for i in range(len(L1)):
    print "Poped: %s" %(L1.pop())

output
Poped: d
Poped: c
Poped: b
Poped: a

You may also want to look into unwrapping, like this example:

coords = [14, 16, 4]
x, y, z = coords
"""result -->
x = 14
y = 16
z = 4
"""

Having one list like L1 =
need to do pop operation and assign value like,
z1 = L1.pop()
z2 = L2.pop()
z3 = L3.pop()

In Python you do not have to reassign the value. Use the list values, unless you reassign for some other reason.

list_1 = ['a', 'b', 'c', 2, [3, 4, 5] ]
print list_1[-1]
##
el = len(list_1)
while el > 0:
   el -= 1
   print list_1[el], type(list_1[el])
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.