142,020 questions
-1
votes
2
answers
60
views
Modify elements of a list based on another list
I have two lists that look like -
list_a = [('gfhr_10_dfrght_sl', None, None), ('gfhr_11_dfrght_sl', None, None), ('mnop_yxt_done', None, None), ('mnop_yxt_gd', None, None), ('frdf_yxty_syn', None, ...
0
votes
2
answers
95
views
I did some inline code for an assignment and I was wondering if using it would be more efficient with or without
The goal of the assignment was to initialize an empty list called rand_array then fill it with 10 unique random numbers
I figured out the assignment normally as per the teacher's directions:
import ...
0
votes
0
answers
68
views
Index was outside the bounds of the array but no index or array modification going on [closed]
I am having a hard time tracking down how this error happens with this code. I keep getting an index was outside the bounds but not sure how that happens when the array doesnt get modified or ...
-3
votes
2
answers
57
views
Check whether one string can be formed by another string in Python
I want to check whether one string can be formed by another string, e.g., in the example below, I want to check how many strings in the list targets can be formed by string chars. Each character in ...
2
votes
1
answer
131
views
Collections.remove() vs Iterator.remove() performance-wise
I am traversing a list and want to remove a certain element that matches a condition. I also want to return that element. There are two ways I've come up with to do this.
First:
for (int i = 0; i < ...
0
votes
0
answers
40
views
Function to order a list(of class) by multiple dynamic parameters?
I'm using a list(of Bomlist) to store a lot of information about individual items and depending on what I'm going to use the list for I'll order it different ways. I'm curious if there is a good/...
0
votes
2
answers
89
views
From many RData within different subfolders, list only data.frames, select some columns, then rbind them all and unlist
I've searched extensively, but I can't find a solution that meets all these objectives at once:
I have hundreds of RData files located in different subfolders.
In each of these RData files, I have a ...
-3
votes
1
answer
72
views
How to remove duplicates from a list in Python while preserving order? [duplicate]
I'm trying to remove duplicate items from a list in Python, but I want to preserve the original order of the elements.
For example:
my_list = [1, 3, 2, 3, 1, 5, 2]
I tried using set() to remove ...
-5
votes
1
answer
79
views
Separating/Adding lists together for a 2D array [closed]
I have a list of numbers and need to analyze them in two different ways.
[[ 0, 1, 0, 1, 0], [1, 1, 1, 1, 1], [ 0, 1, 1, 1, 0]]
I need to add up any 1's and group them but ONLY if they're after each ...
0
votes
0
answers
34
views
Can I create a list in a Scratch extension?
I'm developing a Scratch extension that will add some very useful features to the game. However, right now I'm trying to create a reporter that will split a string into a list at a certain character. ...
2
votes
0
answers
116
views
Implementing and Optimizing Unrolled Linked Lists in C++ for Benchmarking [closed]
I'm working on a project to benchmark the performance of various list implementations in C++ (e.g., std::list, std::vector, possibly others) against a custom implementation. I'm particularly ...
-2
votes
2
answers
44
views
How to prevent duplicates in python [closed]
So I created a list of grocery items
I wanted the user to be able to add items but prevent them from duplicating items that are already on the list how do i do this
1
vote
3
answers
89
views
Generating all length-N combinations of all length-M sublists of a list, without repetitions
I have a long input list, and I want to generate combinations of 3 elements. But each combination's elements should be drawn from a length-5 sublist of the original list, rather than drawing elements ...
10
votes
6
answers
535
views
Filter data.frame by list
I want to be able to filter a given data.frame by a dynamic list.
Lets say I have a list of filters like this
filter_list = list(filter_1 = list(vs = c(0), carb = c(1,4)),
filter_2 =...
0
votes
1
answer
93
views
Change name column in a list of .csv file [closed]
I have a folder with about 300 .csv files. I was able to read all of them and list them in R with this script
allsp <- gsub("\\.csv$","", list.files(pattern="\\.csv$"))...