Most voted "list" questions
A list is an abstract type of data that represents a sequence of values, in which the same value can occur more than once. The main ways to implement a list is through an array (array, vector or one-dimensional matrix) or a chained list.
Learn more…1,022 questions
Sort by count of
-
5
votes2
answers62
viewsIs there a method of merging equal items into a var list in LINQ in C#?
Hello, good morning, good afternoon or good night, all right? I have a method that obtains products from a database using LINQ in C#, but on that list there are products that are repeated, so you…
-
5
votes2
answers197
views"List Comprehensions" is it worth it?
Is the use of List "Comprehensions" in Python a good use? Affects program performance (runtime, etc..)? Some examples: # Lista com números pares de 0 a 10: par = [x for x in range(11) if x % 2 == 0]…
-
4
votes2
answers1311
viewsHow to get position of a sub-list within another list?
I have a list of bytes and I need to check if it contains a sub-list of bytes in a specific order. How can I do this check by getting the position of the sub-list in a simple way, using the…
-
4
votes1
answer813
viewsHow to make a Chained List in Assembly?
I have a college job and I need to make a chained list at Assembly, would like to know how to do the loop to insert all items in the list and keep them connected. The list must contain the data of a…
-
4
votes1
answer2475
viewsHow to transform a list into a vector in R?
How to transform a list into a vector in R? The list is a set of words and numbers and I need to add the numbers present in the list. mylist <- list ("2 tomates", "5 tomates", "9 tomates") If I…
-
4
votes2
answers1762
viewsHow to return the position of an element in the Hashset?
I have the following structure: HashSet<Contato> contatos = new HashSet<Contato>(); How to return the position of a particular Contact element that is contained in the Hashset? I was…
-
4
votes2
answers466
viewsHow to go through Arraylist with daughter class
Next, I have one ArrayList student type (which is an abstract class), and I have two daughter classes (EstudanteGraduacao and EstudantePosGraduacao), when I’ll add them to ArrayList it’s quiet, but…
-
4
votes2
answers2923
viewsComparing contents of a Column
I’m a beginner in R and needed help comparing column content. First I sorted my table according to a specific column. For this I used the following function: x = fread ("x.txt",sep=";") x_ordenado =…
-
4
votes1
answer738
viewsPass List to a sub report and call it in main report
Guys I have a method that generates a pdf report in a certain directory, now arose the need to use a sub report, but I’m having difficulty understanding how to pass a List as the data source for…
-
4
votes2
answers4158
viewsHow to create a dynamic chained list within another dynamic list in C?
I’m having a really hard time creating a dynamically chained list inside another one using data structure. I can create a dynamic list, but I can’t create another one inside it. To illustrate what I…
-
4
votes1
answer1707
viewsOrdering a second list according to the ordering of the first list
I have the following (silly example): lista=[[3,6,4,2,7],[8,4,6,4,3]] I want to put lista[0] in ascending order, modifying lista[1] in accordance with lista[0]. To illustrate what I want below:…
-
4
votes2
answers15191
viewsHow do I know if a list is empty in Python?
I’m starting at the python and always end up appearing some doubts at the beginning. I need to know how to test if a list is empty. As I always say, I come from PHP. So I used to make these shapes:…
-
4
votes1
answer127
viewsHelp with logic
I have a method that reads several tags from a file . xml and returns a list filled by the data read. Problem: Each xml file has several batches and within the batch has several tabs, for example, I…
-
4
votes2
answers6881
viewsGraph possible python paths
I have a dictionary, where the key is a vertex and the value is a list of vertices adjacent to the vertex (key). dic = {'A':['B,'C'],'B':['A','C','D'],'C':['A','B','D'],'D':['B','C']} What I want is…
-
4
votes1
answer21806
viewsRead rows and columns by Python, by excel
My doubt is if there is any resource for me to be able to read excel rows and columns. For example: I have experimental data in excel containing header in the first row having about 12 columns of…
-
4
votes1
answer682
viewsSend only object from the list that has changed to the controller
I own a view who lists all my customers. Each customer has 3 checkbox where the user selects them, and sends them to the controller - through the button (Submit) - the data to change. The method is…
-
4
votes6
answers41177
viewsHow to find the position of an item on a list?
I am writing a program that takes a specific amount of values, and returns the lowest value of the list and its position. It is as follows: quantidade = int(raw_input()) numeros = raw_input()…
-
4
votes6
answers201
viewsHow to remove 2 digits from each item in the list?
I have a list/array: var lista['01.um','02.dois','03.tres'] I need to create a new list like this: lista['01','02','03'] I know little of Groovy and Java, which is the correct way to create the…
-
4
votes1
answer1947
viewsHow to extract Array from JSON into an object’s List type attribute
I am using the Flickr API to get the information from the images, which returns the following JSON:…
-
4
votes1
answer2424
viewsrunning split() to form a list within another list
have the following list: [['a:/, b:/, w:/, g:/, f:/, d:/Downloads/Torrent/End, x:/files.2t, y:/files.1t'], ['d:/Dropbox/project/rato_bat'], ['data']] however I would like it to be a list within…
-
4
votes2
answers1277
viewsHow to store a List<Object> in a database?
I am working on a project in C# where I have the following situation. I have a class that represents player: class Player { int ID; string Name; } and another representing a team: class Team { int…
-
4
votes1
answer3476
viewsHow to put elements of a list in another list
I have the following code: a = list() b = list() c = list() a = (1,2,3) b = (2,4,6) c = a + b[1] print(c) How do I add an element from a list to another list?…
-
4
votes1
answer187
viewsRename an element in a Jlist
Greetings, my friends. I have a problem in Java. I am trying to add a "Occurrence" element to a Jlist. This element has 4 elements within it, which I need to maintain. So far so good. However, the…
-
4
votes1
answer149
viewsWrite list in binary file
The idea of this method is to write all the words of a list of nodes in a binary file. I have a linked list of nodes, where each node has two information, its information, and a reference to the…
-
4
votes3
answers16117
viewsHow to transform a string composed of numbers into an integer list?
I have a list with a string: a = ["1, 2, 3, 4"] I want to take each number inside that list, turn them into integers, and return the highest and lowest value of that list. I’ve tried this with the…
-
4
votes2
answers223
viewsIs there a performance difference between Tuple and List?
In Python, I know there’s a difference between Tuple and a List. To Tuple is immutable, and the List, mutable. You even have that question here: What is the main difference between a Tuple and a…
-
4
votes1
answer13184
viewsassignment list index out of range
Part of my Python program is: dt=1 maxt=3600*2 t=range(0,maxt,dt) r=len(t) Tsup_i=20 for i in range(1,r): Tsup[0]=Tsup_i P[i]=((I_dc)**2) * R20 * (1 + a * (Tsup[i] - (20+K))) And the error is…
-
4
votes3
answers756
viewsGet larger number of items in a Python list array
I have a Python array composed of arrays. But these arrays can have different sizes. For example: matriz = [[1,2,3],[4,5,6,7],[1,2,3,4,5,6]] What I want to know is if there is a medium (some python…
-
4
votes2
answers98
viewsFaster way to add an item to a list, using a structure
Structure turma Public id_turma As Integer Public nome_turma As String End Structure Structure Disciplina Public id_disciplinas As Integer Public nome_disciplina As Integer End Structure Public…
-
4
votes3
answers2170
viewsHow to compare two List and delete repeated fields?
How to compare to lista1 and the lista2, excluding the items repeated in one of them?
-
4
votes2
answers2008
viewsSave multiple instances of a class to a List in Java
I have a college job that I need to create several instances of an object Pessoa and save these instances in a listing to show the user when needed (this will work as a database). Since we haven’t…
-
4
votes1
answer158
viewsHow to extract every umpteenth element from a list?
Considering a list composed of several vectors: lista<-list(c("1949", "1963", "45", "X2752009", "X2752013", "X2753007", "X2850009", "X2851005", "X2851008", "X2851014", "X2852002", "X2852003",…
-
4
votes2
answers621
viewsEntityframework . Asenumerable() or . Tolist()?
In one of the projects I picked up I saw the following code, which implements a data listing method of a given entity, but this listing is used only for reading: /// <summary> /// Listar todas…
-
4
votes1
answer77
viewsList being modified without implementation
I’m having a problem where the list I’m working on is being modified even though there’s no value passing to it. from random import * from numpy import * m=2 lista_inicial=[[1, 2], [0, 2], [0, 1]]…
-
4
votes2
answers608
viewsHow do I know which Arraylist objects are being modified or deleted?
I own a ArrayList that this preloaded with some objects of the type of my class Person, see: ArrayList<Pessoa> listaDePessoas = new ArrayList<>(); listaDePessoas.add(new Pessoa("Joao",…
-
4
votes1
answer436
viewsHow to shuffle string list in c#?
I have a console application, in which there is a list: List <string> ListaFrases = new List<string>(); This list is built through user inputs in the console. How to display your…
-
4
votes1
answer438
viewsPython remover() list index out of range
def gera_huffman(simbolosOriginal, probabilidadesOriginal): # gera_huffman(['a', 'b','c', 'd'], [5, 2, 1, 2]) simbolos = simbolosOriginal probabilidades = probabilidadesOriginal lista = [] while…
-
4
votes1
answer964
viewsHow to delete objects within a list?
I have the following code: using (Context contexto = new Context()) { List<Cliente> listCliente = contexto.Cliente.Where(x => x.Status == 0).ToList(); } How do I delete this result from the…
-
4
votes1
answer1263
viewsConcatenation of two chained lists
The problem is: Write a program and make a function to concatenate two lists of integers into a third list that must be returned by the function, in C#. My doubt is only on how to concatenate the…
-
4
votes2
answers1240
viewsRecursion to Python List Inversion
I’m trying to create a recursive function that reverses the order of a certain list. As a beginner, I believe I’m making mistakes during the construction of the function. def inverter(lista, size):…
-
4
votes1
answer6347
viewsHow to modify an element within a Python list?
I have the following list: pessoa=("Filipe", 40, True) I write the print command for each element: print(pessoa[0]) print(pessoa[1]) print(pessoa[2]) the answers are: Filipe 40 True When I try to…
-
4
votes2
answers888
viewsHow to get the row and column indexes of a list List<List<int>>?
I have a list that simulates a matrix (or two-dimensional array) that is structured as follows: List<List<int>> matriz = new List<List<int>>(); Whereas this matriz is…
-
4
votes1
answer351
viewsMerge the contents of two lists by considering the contents in Python?
The scenario is this, I have two lists, ex: list1 = [1,2,3,4] list2 = [5,6,7,8] I want to generate a new list that looks like this: [15,26,37,48] That is, to "join" the elements of each index. I did…
-
4
votes1
answer134
viewsView 2 dataTextField in a Selectlist
Hello! I have a little problem to make a selectlist display 2 values in textfield. I have the following Selectlist which is stored in a viewbag: ViewBag.Account = new SelectList(new…
-
4
votes4
answers412
viewsHow to check if a list contains 3 consecutive numbers
Insert a vector with 10 random integer values. Then check if there is a sequence of 3 consecutive numbers in the vector. Two values are consecutive if the difference is 1 unit example: A = [10, 5,…
-
4
votes1
answer1959
viewscalculate a row-by-line list media in python
question: Using the text file notes_students.dat write a program that averages each student’s grades and prints each student’s name and average. filing cabinet: jose 10 15 20 30 40 pedro 23 16 19 22…
-
4
votes2
answers594
viewsWhat is Java Sort?
Every programmer know that a list of arrays are printed in an orderly way, but in the middle of the way sort(). The result of the impression was this: Abacaxi Banana Laranja Manga I thought it would…
-
4
votes2
answers379
viewsRecover List Written in Python File
I’d like to go to my file that contains the following ['teste1', '27-12-18', '12/5/2015', 'Aberta'] ['teste2', '27-12-18', '6/7/7', 'Aberta'] ['teste3', '27-12-18', '12/5/6', 'Fechada'] and only…
-
4
votes1
answer134
viewsConcatenate files according to the order of the list C#
I have a program that concatenates PDF files. First it does the SPLIT of all pages of each file and store them in a temporary folder. When I press the end button, it calls a function GetFiles() that…
-
4
votes3
answers176
viewsDoubt exercise with lists
Follow the problem: Create a Python function that takes a list and returns how many numbers are positive. If a list element is not an integer or real number (float), the function must stop and…