Questions tagged [list]
The list tag may refer to: a linked list (an ordered set of nodes, each referencing its successor), or a form of dynamic array. Not to be used for HTML lists, use [html-lists] instead.
130,173
questions
-1
votes
0
answers
6
views
How to render a form according to fields recieved by server in react?
I am working on a fleet management app. Home page consistes of type of vehicles (CAR, Pickup truck, etc) when an user selects one of these options and hit submit. React front end makes a get request ...
0
votes
0
answers
12
views
allocate one list in memory and pass it to a python subprocess in a new console
i'm studying python, on a windows system it's possible to allocate one list in memory and pass it to a python subprocess in a new console?
Thanks for your help
0
votes
0
answers
11
views
Python multi dimensional lists [duplicate]
i try to learn how multi dimensional lists work. In this code i try to modify specific element in list but it changes other elements too. How and why this happens?
code:
list1 = []
first_inner_count = ...
0
votes
2
answers
24
views
Call different list with similar name in a for loop
I have a few lists that are with names: group1, group2, group3...
I need a for loop (lets say for (int i=1; i<=6; i++) and right now I check for example if i is 1 then use group1, if i is 2 use ...
0
votes
1
answer
15
views
R returns partial (incomplete) results from function
I try to compare models in a meta-analysis that I calculated using the package metafor (rma.mv- or rma - function). I try to write a function that extracts specific values (here: just beta and the ...
-1
votes
1
answer
24
views
Why does my slice do not change the values of the pointed dictionary in list but changes the values of all the dictionaries in my list?
I am trying to change only one out of three identical dictionary in my list using a for loop to slice out exactly the 2nd dictionary on my list. But somehow the values of all the 3 dictionaries in my ...
1
vote
1
answer
48
views
Filtering tuples within a range from a reference list
I have a reference list of tuples containing different range of values.
[(1042, 1056), (895, 922), (966, 995), (692, 716), (667, 690),
(667, 690), (667, 690), (479, 508), (1112, 1578)]
I have the ...
1
vote
1
answer
20
views
Assigning variable names in R from a list within expand.grid
I am trying to automatically generate variable names (that all follow the same naming pattern x1,x2,...) within the expand.grid function in R.
Here is a miniature version of my problem:
I have a list ...
0
votes
1
answer
25
views
create a python Tree from a list of strings
Im using the newest version of python on a windows10 machine.
I have a list of 100k routes that semi trucks take. Each route only has 1 single stop. Each route originates at cityA and travels to cityB....
0
votes
0
answers
27
views
Most optimal way to exhaust a list of queues
I have a list of deque, built from a 2d array:
data = [[4,2,5,23], [3], [4], [9,82,4,3,56,7]]
data_q = [deque(i) for i in data ]
I need to popleft a value from each queue, in order, until all queues ...
0
votes
1
answer
18
views
How to extract list of specific keys from the dictionary in Python?
I have a list of dictionaries that looks like that:
lst = [{'id': 'ID1', 'Name':'Name1', 'Surname':'Surname1'},
{'id': 'ID2', 'Name':'Name2', 'Surname':'Surname2'},
{'id': 'ID3', 'Name':'...
0
votes
1
answer
29
views
choose same file in path list file in another path list file
I have a list of path file
image_list1 = ['/content/gdrive/MyDrive/Match/bed/2.jpg','/content/gdrive/MyDrive/Match/bed/4.jpg']
and
image_list1=['/content/gdrive/MyDrive/Match/chairs/4.jpg','/content/...
0
votes
2
answers
29
views
How to delete "," at the end of the program python set
l = {"John","Evan"}
for i in l:
print(i,end=",")
How to get python to output: jhon,evan not: jhon,evan, ?
-3
votes
1
answer
18
views
for loop runs 84 times but collect data from only first item (web element) and list get filled with repeated data [closed]
website = 'https://www.bsupa.org.uk/sup_school/'
driver.get(website)
all_jobs = driver.find_element(By.CLASS_NAME, 'sup-school-content')
jobs = all_jobs.find_elements(By.TAG_NAME, 'li')
company_name ...
0
votes
1
answer
39
views
C# Previous object is overwritted when adding new object to list
When I am adding new Timer to _timers it is overwriting previous one.
Console.WriteLine(_timers.Count()); is always writing 1
string.Join<string>(", ", _timers.Select(x => x.Uuid)); ...
-1
votes
2
answers
30
views
Percentage distribution of values in a python list
Let's say we have following list. This list contains response times of a REST server in a traffic run.
[1, 2, 3, 3, 4, 5, 6, 7, 9, 1]
I need following output
Percentage of the requests served within a ...
0
votes
3
answers
43
views
Max function doesn't seem to work properly?
Ok so kinda confuse with the max function, warning, very messy (just started learning yesterday using youtube and programiz)
m=input()
k=m.split()
k=list(k)
h1=(max(k))
print (h1)
k.remove(max(k))
h2 =...
-4
votes
0
answers
23
views
Regex pattern for letter followed by a special character and number [closed]
Whats the regex needed to match these strings in python?
E~1
E*2
+3
0
votes
0
answers
10
views
Pandas: filter / query rows based by string input or list [duplicate]
frame containing some information of stars, I would like to be able to filter to a new data-frame to only show the stars of interest list:
selected_stars = ["Polaris", "Deneb", &...
0
votes
0
answers
50
views
Loop through a list with an index in Python
I have a data frame, within the data frame I hold the temperature values. I want to calculate the average temperature within an interval. Therefore, I have a first_temp variable, when I add its index ...
1
vote
4
answers
39
views
How can I create an input that will loop and create a new list each time?
in case it isn't already obvious im new to python so if the answers could explain like im 5 years old that would be hugely appreirecated.
I'm basically trying to prove to myself that I can apply some ...
-1
votes
0
answers
33
views
Linked list multi parameters how to do?
I have this part of structure and a list , and I want to fill up with same values.
typedef struct node{
char* place;
int id;
int type;
int price;
struct node * next;
}node;
...
-1
votes
0
answers
6
views
I need to find the second maximum from the list and tried to find this by using diff method, but this method is not working, but its correct
4th method
def submax(list2):
sub = [x for x in list2 if x<max(list2)]
return max(sub)
if name == 'main':
list2 = [70, 11, 20, 4, 100]
print(submax(list2))
3
votes
2
answers
23
views
extract the same column from all matrices in a nested list
There are many entries on this problem but none has solved mine. I need to extract the first column of all the matrices in a nested list.
dput(dlist4)
list(A = list(a = structure(1:4, dim = c(2L, 2L)),...
0
votes
0
answers
7
views
I tried to solve this but first i Got the output and then i got this error, getting this error. "TypeError: 'int' object is not callable"
list2 = [20, 10, 20, 4, 100]
print(max(list2))
It tried this but getting this same error, also i tried to use inbuilt function while solving
TypeError: 'int' object is not callable
0
votes
2
answers
24
views
Need to remove every third element in a list of 10 elements - getting index error
I keep getting IndexError: list assignment index out of range. My logic is as follows: The print(x) shows that 6 is printed out before getting the error. Working through the code logically, 6 % 4 == 0 ...
-1
votes
0
answers
47
views
how can i put condition that makes a nestesd list elements diffrente in the position ?? in python
how can i code a nested list gives me this rusult , the out put i want is
MC2 = [[1,1,1,1,0],[0,0,0,0,1,1,0,0,0,0],[0,0,0,0,0,0,1,1,0,0,0,0,0]]
len of each list is token from list D and number of 1 ...
0
votes
1
answer
18
views
Why is my input statement not transferring float into the list?
Pycharm Screenshot!
#Accept a list of 5 float numbers as an input from the user numlist=[]
for i in range(0,5):
numlist[i]=numlist.append(float(input("Input a number:")))
print(numlist)
#...
0
votes
0
answers
11
views
Table of Mixed Data - List, Table, or Other
I'm looking for an efficient way to deal with mixed data similar to Matlab tables. The functions associated with a List to Add, Delete, Sort, would all be useful but do not seem to work with mixed ...
2
votes
2
answers
46
views
How filter out Unique elements from a String and store them into an ArrayList
Given a filtered string. I want to add its substrings to an ArrayList only if it doesn't contain it already.
My code:
Pattern reg = Pattern.compile(",");
ArrayList<String> SANR = reg....
1
vote
1
answer
23
views
In a list of matrices: keep the non-zero section in each matrix
I have a list of matrices varying in dimension and each matrix has one all-zero row or column or an all-zero column and an all-zero row. I believe there should be an efficient, one-liner to trim them ...
1
vote
1
answer
26
views
R: empty lists inside list of lists after running function + for loop
I have a list of dataframes which contain two columns with variables: var1 and var2. Several of the variables in var1 and var2 are NAs. Now, I want to create a new list of dataframes in which each ...
0
votes
3
answers
55
views
Fun With Anagrams
Hi im trying to solve this riddle:
Given an array of strings, remove each string that is an anagram of an earlier string, then return the remaining array in sorted order.
Example
str = ['code', 'doce',...
0
votes
2
answers
39
views
To retrieve data from list where it contains dictionary as its values (python)
I am newbie to python, trying to understand the concepts. I am trying to traverse a list, where inside list, I have kept dictionary data set which are initialized. I have defined function to traverse ...
0
votes
1
answer
28
views
Is there a way to permutate list of lists while keeping the lists together?
list1 = [[1,2,3],[4,5,6],[7,8,9]]
Is there anyway possible in the realm of coding that I can permutate this list of lists while keeping the "groups" together?
I really need this solved, ...
1
vote
1
answer
27
views
What is the difference between dict[new_key] = [dict[key], new_value] and x = dict[key] + [new_value]?
I was reading the Python Patterns essay on graph implementations, and came across the section that discusses the optimal implementation of finding the shortest path. The article is here.
I couldn't ...
0
votes
2
answers
24
views
List Indexing - Read File, Find Specific String, Replace String, Output New File
I have the following code, which i am attempting to read any file in, line by line searching for specific values from a list. If a value from within the old list is found, replace the found string ...
0
votes
1
answer
31
views
Matching values within a dictionary and grouping elements to a new dictionary key
I have a dictionary which has the following form:
{ 1:['a','b'],
2:['c','d'],
3:['b','e'],
4:['g','c']
..........
}
I want to find out if any values from the values matches with values in ...
-3
votes
2
answers
66
views
find sublist by using recursive generator in python
The nested list is like:
nested_list=['a', ['b', ['c', 'd', 'e'], 'f', ['g', 'h']], 'i', ['j', 'k']]
and we can clearly see its structure:
a
b
c
d
e
f
g
h
i
j
k
Here is the thing I want to do:...
0
votes
1
answer
46
views
c# removing an item in list by their name
So I have a list of items/pokemon with the same name and i would like to remove them and their attributes from the list, how can i do so with linq or list.Remove?
this is my pokemon.cs
public class ...
2
votes
6
answers
70
views
Deep list count - count lists within lists
I am trying to get the length of a list, but that list can contain other lists that are deeply nested (e.g. [[[[[[[]]]]]]]).
But you have to get any non list elements in the count as well: [1, 2, [3, ...
-1
votes
1
answer
42
views
Remove every nth item from a list in C#
New to C#, as a beginner program I would like to recreate the MASH game as a console application. If you don't know, this is the MASH game:
https://mashapp.com/play-mash-online-free/
I currently have ...
0
votes
3
answers
41
views
How to arrange items in ascending order in list Python
I have the below files in a directory:
Using os.listdir() I am reading all the files and then saving them in a list. Below is the code:
y = []
files = os.listdir()
for file in files:
if "mb&...
0
votes
3
answers
27
views
Find sequences where all elements have same sign and then change sign
I have a series of lists with 7 elements (but could be any number). I am trying to find the lists that have all positive elements, all negative elements, and those that change sign at ANY point,
for ...
1
vote
2
answers
23
views
How to use a command all the 4th item nested lists in netlogo
I have built a long nested list having the following profile:
set my-list [A 1 2 3 4] [B 5 6 7 8] [C 9 10 11 12]
I'd like to apply the meancommand to the fourth item of each nested lists, so in the ...
1
vote
4
answers
32
views
Filter a list containing specific string
My Goal
I have a specific set of a long list containing many asset pairs with different endings: BTCUSDT ETHBTC ANKRETH... From this list, I would like to filter out the symbols ending with USDT.
My ...
0
votes
2
answers
17
views
how do you split a list into 3 lists, for each list in a list? Python Beginner
list1= [[1,2,3,4,5,6,7,8,9],[1,2,3,4,5,6,7,8,9],[1,2,3,4,5,6,7,8,9]]
Result should be:
list2 = [[1,2,3],[4,5,6],[7,8,9],[1,2,3],[4,5,6],[7,8,9],[1,2,3],[4,5,6],[7,8,9]]
This should work for any list ...
0
votes
2
answers
45
views
(Python) How to extract elements between parentheses from a spliced list
So I was doing a PEMDAS calculator and I managed to do everything but the parenthesis so my question is how to extract from a list like this :
r = ["4","+","2","(&...
0
votes
1
answer
37
views
I need multiple indexes of a list displayed in a text area
I am trying to fill a list of products and other correlating items but am struggling to figure out how to get them to print out each product to its own area. I can get individual items to print out by ...
-1
votes
0
answers
15
views
iterating through json in python
[{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et ...