Hi

I have a list that I am splitting into pairs of values. But the list is dynamic 
in size. It could have 4 values or 6 or more.

I originally split the list into pairs, by using a new list and keep a pair in 
the old list by just popping 2 values. But if the list is longer than 4 values. 
I cannot do this. I can only envision I would need to dynamically create lists. 
How would I do this?

while returned_list_of_items:
    for i in range(1):
        new_list.append(returned_list_of_items.pop(0)) #pop first value and 
append
        new_list.append(returned_list_of_items.pop(0)) #pop second value and 
append

Thanks                                    
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to