##### Problem with append list in loop
 Problem with append list in loop michaelko03 Unladen Swallow Posts: 1 Threads: 1 Joined: Feb 2020 Reputation: Feb-16-2020, 07:04 PM (This post was last modified: Feb-16-2020, 07:05 PM by michaelko03.) Here is my code ```import math import numpy as np z = 0 y= [] x = [] while z < 5: z = z + 1 t = 0 x.append([y]) while t < 8: A = 10 + t y.append(A) t = t + z print (x) I want to separate the result of y list in each cycle from the second while loop I expect the result will be [10,11,12,13,14,15,16,17], [10,12,14,16],[10,13,16], [10,14], [10,15] [10,16] but the outcome is [10,11,12,13,14,15,16,17,10,12,14,16,10,13,16,10,14,10,15,10,16 [10,11,12,13,14,15,16,17,10,12,14,16,10,13,16,10,14,10,15,10,16], [10,11,12,13,14,15,16,17,10,12,14,16,10,13,16,10,14,10,15,10,16], [10,11,12,13,14,15,16,17,10,12,14,16,10,13,16,10,14,10,15,10,16], [10,11,12,13,14,15,16,17,10,12,14,16,10,13,16,10,14,10,15,10,16]```can anyone help me? Thank you Reply

 Possibly Related Threads… Thread Author Replies Views Last Post How to append multiple into a single List ahmedwaqas92 2 508 Jan-07-2021, 08:17 AM Last Post: ahmedwaqas92 Infinite loop problem Zirconyl 5 579 Nov-16-2020, 09:06 AM Last Post: DeaD_EyE Appending to list of list in For loop nico_mnbl 2 519 Sep-25-2020, 04:09 PM Last Post: nico_mnbl Dataframe mean calculation problem: do we have to loop? sparkt 1 638 Aug-28-2020, 02:41 PM Last Post: sparkt How to append to list a function output? rama27 5 866 Aug-24-2020, 10:53 AM Last Post: DeaD_EyE Append list into list within a for loop rama27 2 736 Jul-21-2020, 04:49 AM Last Post: deanhystad Python loop problem Kristenl2784 11 1,436 Jun-18-2020, 07:22 PM Last Post: buran Append only adding the same list again and again viraj1123 4 691 Jun-17-2020, 07:26 AM Last Post: viraj1123 Cant Append a word in a line to a list err "str obj has no attribute append Sutsro 2 710 Apr-22-2020, 01:01 PM Last Post: deanhystad append list to empty array SchroedingersLion 1 882 Feb-02-2020, 05:29 PM Last Post: SchroedingersLion

Forum Jump:

### User Panel Messages

##### Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020