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
-
2
votes1
answer1122
viewsBrowse Arraylist of object objects and compare c#
I was wondering how I can reuse the object I put into an array list because I can’t compare it to anything, and how I compare an object inside it to another, in this college program the goal was for…
-
2
votes2
answers287
viewsFilter a list of spans with jquery
I needed it a little urgent, can you help? I need to filter a list of spans : <div class="list-group pre-scrollable lista"> <?php for($i = 0; $i < count($ambientes); $i++) { ?>…
-
2
votes0
answers139
viewsWhat is the best technique to use Viewmodel with C#mvc lists?
I have two templates: event registration package and registration package, where the event registration package template has a list of registration packages (see code below, removed some fields).…
-
2
votes1
answer400
viewsHow to count the elements of a list
I have a list that stores data: [(pizzas, 'COMIDA'), (1, 'QUANTIDADE'), (chocolate, 'SABOR'), (1, 'QUANTIDADE'), (catupiry, 'SABOR'), (1, 'QUANTIDADE'), (morango, 'SABOR')] I’d like to check what’s…
-
2
votes2
answers458
viewsSort a java List containing null values
Good morning! In my List, when I do the ordering I would like the null values to be last. I’ll show you an example to make it clear: Code output (in this case the word would be the letter after the…
java list arraylist comparison collectionasked 6 years, 10 months ago Carlos Rafael de Oliveira Carn 50 -
2
votes1
answer410
viewsWhy can’t I make an "append()" on a list formed from a "Join()"?
I started creating a list in Python leaving each element below the other through the join(). Then I tried to add an element to the list through append(): abc = '\n'.join(['a','b', 'c'])…
-
2
votes2
answers201
viewsAssociative class with double dependency
I was searching the internet and saw this way of making association between Java classes. Is it correct to make this type of association? 'Cause I did a lot of research on the Internet and I…
-
2
votes2
answers2197
viewsWhat is the most efficient way to clear a list (List) with C#?
I have a scenario here where I create a list to check some items, and I need to clear this list inside the loop, and I got some questions regarding the performance I must check the list before I…
-
2
votes3
answers1958
viewsHow to print list elements in reverse order?
I created a program that takes integers from the user and prints them back in the reverse order that received them, however my program is not returning all integers it receives. When I enter 9…
-
2
votes1
answer114
viewsDetermine the number of items in a list that are within the limits defined in another list
I have a ListBox that contains an undetermined value of values and I want to play those values to a List<> and from what I’ve researched, I’ve made it this far: var todosValores =…
-
2
votes2
answers90
viewsValidando fechamento de factura para tipo de compra e venda Javascript e submeter para uma api
I’m a beginner and I’m stuck on the invoice closing validation. I built a list in this format: [ date: '2017-5-9', value: '59.99', type: 'credit', typePag: 1 }, { date: '2017-12-17',value: 'R$…
-
2
votes4
answers1133
viewsAdd negative elements from a list
I want to add up only the negative elements of a Python list. The code I initially thought was: lista = [12, -2, 4, 8, 29, 45, 78, 36, -17, 2, 12, 8, 3, 3, -52] for n in lista: if n < 0:…
-
2
votes2
answers426
viewsLists in PYTHON
I’m using lists to do a little programming. Initially I wanted to make a program that created as many variables as the person wanted, but I found an easier way. I thought I’d create a list and add…
-
2
votes1
answer52
viewsCheck if two elements of a list are numbers
I’m trying to verify that two elements of a three-element list are numbers. I just want to check the second and third elements of the list. I have the following code and cannot identify the error:…
-
2
votes1
answer331
viewsTop 3 the biggest numbers in the list and their indexes
I have the list [5, 7, 2]. I need to create another list containing the indexes in this list, ordered so that the first index corresponds to the largest element in the list, the second corresponds…
-
2
votes1
answer374
viewsHow to add an element at the end of a linked list
I need to add an element at the end of a linked list, I did the method asking it to add as if it were an initial element if the list is empty (it is working) and, if it is not, scrolling through the…
-
2
votes2
answers773
viewsHow to subtract several elements from a list?
I am making a calculator and would like to subtract several elements from a list, this because the list can have as many elements as the user wants. See my code: lista = [10, 5] subt = lista[0] for…
-
2
votes1
answer480
viewsDifference between Dictionaries and Lists/Arrays?
I am trying to understand the concept of each and its differences. I want to understand in which situations to use one or the other.
-
2
votes1
answer865
viewsMethod to Invert a Single Chained List
How to make the method ImprimirLista() print the inverted list. Exemplo [1][2][3] Imprimir [3][2][1] Edit 1 I can’t use Collections public class ListaEncadeada { No primeiro,ultimo; int totalNos;…
-
2
votes1
answer97
viewsTask List<T> showing Xamarin error
I am creating a Task List<> but the same shows error in 'Tmodel' Error shown: "Tmodel" type or namespace name cannot be found (using a directive or Assembly reference?) public async…
-
2
votes1
answer256
viewsScroll through a list inside another List
Hello I’m a beginner in Python and I wonder if there is how to scroll through a list within another list, I tried to make an example, but is giving this error: "Typeerror: 'int' Object is not…
-
2
votes2
answers505
viewsCount in recursive function
I need to count how many times a comparison is true within a recursive function, but I don’t know how to do it, because any counting variable will be reset when starting the code. def…
-
2
votes5
answers135
viewsProblems with arrays in a Python password generator
I’m making a generator of passwords and I’m not able to join letters that are separated into one array. from random import choice minusculas = ['a','b','c','d','f','g','h'] maiusculas =…
-
2
votes1
answer298
viewsDetermine sequence of numbers with Bubble Sort from a python txt file?
I have a txt input file with data type the below: 7 6 8 4 8 5 0 1 2 1 0 3 2 3 0 This file is about information for 3 students of a school. The first line is the age of these 3 students (the first…
-
2
votes1
answer133
viewsPassing a Connection string dynamically
Well my problem would be trying to pass a connection string from a txt. file which is also used to bring the items from my Combobox, the goal and bring a different database depending on the item…
-
2
votes1
answer47
viewsThe function returns None although the variable saves the correct result
I must do a function that returns the odd elements of a list using recursion. I saved the list with the odd ones in the variable I, and when return this variable the result is None. def…
-
2
votes1
answer47
viewsHow to create a list of values with restriction on a stipulated number of data
I have the following code n <- 130 pl <- trunc(n/20) p0 <- 20 pp <- 20 + (0:(pl-1))*p0 With the result of pp, being: [1] 20 40 60 80 100 120. In addition, I also use the same process for…
-
2
votes1
answer86
viewsget the values of a generic list List<t>
My project Winforms C# has a form with a GridControl(gvDados) and a button Sue with an event Click(). Validation takes place in the event Click from the process button, through a method responsible…
-
2
votes2
answers37
viewsWhy does entering a value in a list become None?
valores = [] valor1 = valores.append(int(input('Valor 1: '))) valor2 = valores.append(int(input('Valor 2: '))) if valor1 in valores > 0: print(valor1, 'é positivo') else: print(valor1, 'é…
-
2
votes4
answers82
viewsHow do I create a list for possible answers in python?
Well... I wanted to make a list for possible user responses to input, for example: nom = str(input('Você gosta de mim? ')) lista = ['sim','claro','obvio'] if nom == lista: print('obrigado, bom…
-
2
votes1
answer52
viewsIn a list list, how to sum each item of each list with the item of its respective position?
For ex my list is: x = [[1,2,3,4,5],[6,7,8,9]] How can I create a new list so that its elements are the sums of the corresponding elements in each list? y = [1+6,2+7,3+8,4+9,5+0]…
-
2
votes1
answer38
viewsList contents of a list with a method
I have the following code: using System; using System.Collections.Generic; public class Program { class Candidato { public int numeroPartido {get;set;} public string nomeCandidato {get;set;} public…
-
2
votes1
answer84
viewsDoubt - Dynamic list
I have the following structure for my dynamic list: typedef struct DataNode { int id; } DataNode; typedef struct Node { DataNode data; struct Node *Next; } Node; typedef struct List { int size; Node…
-
2
votes1
answer192
viewsSort dictionary and add python values
I have this text file that is processed to capitalize and this part does correctly. olá meu nome é meu nome pois eu olá é meu nome walt não disney olá Then I have this function which should be able…
-
2
votes1
answer104
viewsFunction . split() buging the output of the string in python2, how to solve?
Hello, I’m new to Python and my question may be obvious, but I would like to better understand the workings of the string; I am facing an error of execution of a function that I created and do not…
-
2
votes1
answer40
viewsNull Arriving Object List in Controller
I have a question and hope that someone can help me. I am not being able to send objects from my View to the controller. Every time it comes, it’s empty. I’ve tried a lot of things and I can’t seem…
-
2
votes3
answers561
viewsValidate if a CPF already exists in the List before inserting C#
Good evening, I am creating a sales system (college work) that has a simple registration of Clients (name and Cpf), we are working with the Project in layers, I am having difficulty because I am…
-
2
votes1
answer24
viewsYou can create @POST method with Jersey returning a List
Good afternoon! I am developing a Webservice where I need the query method to receive an object as a search parameter and return the list found in the database. I found several tutorials from…
-
2
votes1
answer63
viewsList only future items in C#
I have a database with a list of shows registered with location, date and time, but I need it to return me on the admin screen only the shows that will still happen instead of listing all shows…
-
2
votes3
answers233
viewsError using append after merging two lists into one
My teacher passed the following problem to be solved and translated to Python: Consider that we have two lists of people names, sedo that these lists are already in lexicographic (alphabetical)…
-
2
votes1
answer971
viewsError "Indexerror: list assignment index out of range" when setting "l[0] ="
I’m having a problem in my class in function __init__() class Lutador(): __nome = "null" __nacionalidade = 'null' __idade = 0 __altura = 0.0 __peso = 0.0 __categoria = 'null' __vitorias = 0…
-
2
votes1
answer499
viewsProblem with chained list in C
I am doing a college job where basically the Program should be done in C language using chained lists and have 3 options: Add music (beginning, middle or end of list) with name, band and duration;…
-
2
votes1
answer480
viewsProblem "List index out of range"
In a Python code I have several conditions that filter my data, and this data is connected to a position counter i. But within one of these specific conditions I need to record the position of the…
-
2
votes1
answer27
viewsRecord an index-specific value and treat the values
The number of Likes is cumulative, that is, if the post has 0 Likes and receives 5 Likes, it will have 0 + 5 =5 Likes. If soon, this same post receives 7 Likes, will have 5 + 7 = 12 Likes. If the…
-
2
votes1
answer130
viewsList containing only the last element in Python
I’m going through a text file and putting its contents in a list of objects, in which each object contains two "string-like" attributes: word and meaning... The problem is that after I go through…
-
2
votes4
answers669
viewsHow to access indexes backwards within a list?
I’m taking the notes that make up the triads of the major chords. For this, I created a list of all possible notes, and according to the chord typed I see the list looking for the first largest,…
-
2
votes1
answer76
viewsSum of Values within Compound Lists
I have a question about how to add certain values in Composite Lists. And I wanted to know that there is a quick method for this very. lista_total = [] d = 0 while True: nome = str(input('Nome: '))…
-
2
votes2
answers128
viewsHow to display a list always sorted as new items are inserted
I am trying to implement a list, in which, each number typed is inserted and counted in sequence, as in the example below: lista = ['0'] while True: ean = input('digite aqui: ' ) lista.append(ean)…
-
2
votes1
answer83
viewsRemove Repeated Elements from a List[0] from the List Database[1]
I have a list structure inside the list (list=[[ ],[ ]]). Example: lista = [['pedro', 'marcos', 'mario', 'pedro', 'marcos', 'mario'],[5.2, 2.2, 6.1, 6.2, 1.1, 5.0]] I am trying to remove the…
-
2
votes1
answer54
viewsRemoving strings from within a list
Hello I have a list I get from a file xls through the library xlrd workbook = xlrd.open_workbook(r"C:\Users\Expedição\Videos\CSV\produtos_filtrado.xls") # Escolhe o arquivo a ser lido. worksheet =…