0
Hello, how can I continually save the results of a loop computation into a single list element.
loops
3 odpowiedzi
+ 4
Use append to add an element to the list.
0
declare a variable and declare an another array increment the variable .....like result [ i ] = your ans and i++ ....where the results are stored
0
my_list = [] #an empty list
loop start #loop of your choice
some_code_here
my_list.append (thing to append each time through)
print (my_list)