Issue I have an algorithm where some array will be given a new index, but the new index is not sequential. For the sake of time, just assume the new index is given to the array at random. Let’s say
Continue readingTag: indices
[SOLVED] Loop/list problem: Seemingly only the last indices are considered and then copied to every else entry
Issue I try to make a table where I calculate an expectation value and vary 3 different parameters i,j,k (and also average over 20 values each). The expected result is a (4,6,5) table/list structure that has 120 different entries depending
Continue reading[SOLVED] Splitting a string by list of indices
Issue I want to split a string by a list of indices, where the split segments begin with one index and end before the next one. Example: s = ‘long string that I want to split up’ indices = [0,5,12,17]
Continue reading[SOLVED] How to get list indices after a specific index
Issue If I have the list: [‘a’, ‘b’, ‘c’, ‘d’, ‘e’], and I want a variable like this: afterC = [‘d’,’e’] – Aka, all items after ‘c’ get put into their own list. I’ve tried searching for a solution, but
Continue reading[SOLVED] Is there a way to use the wildcard in a regex to replace with an index in a list?
Issue So, say I have a string like this: Hello, [1]. And, I have a list like this: ["Joe", "Bob"] Now, I want to use a regex (or anything that will work) expression to replace the [?] (in this case
Continue reading[SOLVED] Gnuplot array with character indices
Issue I would like to create an array in gnuplot with character indices. I have five data files named a.txt, b.txt, c.txt etc. Each text file has two columns of code profiling data (the function name and the CPU time
Continue reading[SOLVED] return all indices of first elements in a list where subsequent values increase incrementally
Issue Need to find indices very similar to here But I have a list of multiple groups of incrementing values, e.g. lst = [0,1,2,7,8,9] Expected output: [0,3] Solution Version with a simple loop: lst = [0,1,2,7,8,9] prev = float(‘-inf’) out
Continue reading[SOLVED] Compare certain indices of many lists
Issue I have a list containing of lists containing of x- and y-coordinates: [[x1, y1], [x2, y2], … [xn, yn]]. I want the smallest and the largest x- and y-coordinates. Since the x-coordinates are always at index 0, I want
Continue reading[SOLVED] How can I obtain the elements in a single list with specified indices?
Issue Suppose I have a list li = [‘a0′,’b0′,’c0′,’a1′,’b1′,’c1′,…,’an’,’bn’,’cn’] I want to obtain [‘a0′,…,’an’], [‘b0′,…,’bn’], [‘c0′,…,’cn’] using a for loop. I’m trying to do something like for i in range(3): # for a,b,c lis = [li[i][k] for i in range(n+1)]
Continue reading[SOLVED] how to look for an element in nested list in parallel
Issue I have a list of elements A = [‘a’, ‘b’, ‘c’, ‘d’] and a nested list B = [{’55’,’a’}, {‘4′,’t’}, {‘x’,’y’,’zx’}, {‘b’,’d’}, {’66’,’c’}]. In addition, each element can appear only in one sub-list of B. I want to find,
Continue reading