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
-
0
votes2
answers162
viewsJoin of lists in Python
How to join two lists in Python to form a single list ? For example, I have this list [[1, 0, 0, 0], [1, 1, 1, 0], [1, 0, 0, 0]] and I want to join her with [[1, 0, 1, 0], [1, 0, 1, 1]]. I want the…
-
0
votes2
answers82
viewsWorking with vectors / matrices
Hello, I have the following question, I have 5 vectors string[] Defesa = { "Gigante", "Golem", "Gigante Real" }; string[] AtkTorre = { "Corredor", "Ariete de Batalha", "Gigante Real" }; string[] AP…
-
0
votes1
answer202
viewsProblem to list directories with java
I’m trying to list all the files in the C: directory on my PC. Smaller directories with 11 thousand files is picking up normally, it takes a while, but it’s no problem. The problem is when I will…
-
0
votes1
answer68
viewsProblem with Accessdeniedexception
I am trying to go through all the files in the C: directory of my computer. Before I was using the IO library, but it was giving some problems and now I’m using the NIO, With the NIO is going well,…
-
0
votes1
answer87
viewsFunction that returns first element of a list
I am trying to make a function that will return the first element of a list in Clisp. I have the following code: (defun pr(NomeDaCidade X Y) (first '(NomeDaCidade X Y))) And trying to call it like…
-
0
votes1
answer37
viewsVariable assigned to another parent variable
Hello, I’m having a problem with Python3: When I create a list and assign the value of another variable to that list, when I change the variable the list is changed, code: lista = ["uau", "nossa"]…
-
0
votes1
answer57
viewsRemove index spaces in a list
In the list below, I want to print only the gender of each index, which, in fact, I can, but as you can notice there are 4 lists that are without definition of gender, which causes, when printing…
-
0
votes1
answer115
viewspython - Print, by line, the letter and nickname append()
Based on the following list:: escritores = [['Pedro', 'Tamen'], ['Almeida', 'Garrett'], ['Camilo', 'Pessanha'], ['Almada', 'Negreiros'], ['Ibn', 'Bassam'], ['Antonio', 'Aleixo'], ['Ricardo',…
-
0
votes1
answer300
viewsException error in Dynamic List C++
I am creating a chained list in C++ and in condition if (j ->n == x), in the method wasVisited which should check if an element has already been inserted in the list, the following message…
-
0
votes4
answers747
viewsGet the most frequent and least frequent element from a list, plus the largest and smallest
How can I find the highest and lowest number, the most frequent and the least frequent, in any list? Current code: import random maiorNumero = 0 menorNumero = 100 arrayNumeros = [] print("Os numeros…
-
0
votes1
answer61
viewsinsert names neatly into a list, I’m not aware of this
//function of inserting there; there only does it with the 3 first names, the others it does not order Aluno *cad(Aluno *aluno) { Aluno *aux; while(1) { aux = aluno; if(aux->prox == NULL) { Aluno…
-
0
votes2
answers326
viewsI need to make a Python entry by storing it as a list, all in one line
I am doubtful in a college exercise, I need to store 3 data which are: Vehicle number, mileage and consumption in each variable of type list, but due to be different types, with the first 2 being…
-
0
votes0
answers116
viewsStd::Begin and Std::end iterators in the circular list context
The Std::list class creates a circular list. When I create an iterator to go through it I come across an ambiguous situation, which I exemplify: #include<iostream> #include<list> using…
-
0
votes2
answers4222
viewsHow to find and show the position of an item in the list, not setting the string value for the search?
How to find and show the position of an item in the list, not setting the string value for the search? Ex: nome_pessoa = str(input('Informe o seu nome completo: ')) lista_nomes = nome_pessoa.split()…
-
0
votes1
answer17
viewsGenerate a single page with all records
I have a query that returns a list with objects. From this list, I go through each position, define some object parameters and return to a view. What I’m trying to do is: Scroll through all…
-
0
votes0
answers48
viewsError in C list of structures
I’m working on a list of structures code, where I have a structure called Cad that contains the registration fields, name and salary. And a list containing a field of type struct Cad that stores the…
-
0
votes1
answer746
viewsJava: Dual-chained list (deck) implementation with callback, Generics, Exception and lambda
I’m doing the implementation in java, however I’m having some problems with how to integrate Generics and lambda in the deck: Deque.java: import java.util.ArrayList; public class Deque { private…
-
0
votes2
answers59
views"print()" does not display the elements of the inserted list
Why does the instruction below not work? It displays the last note, not the list of all notes. jnotas = int(input("quantas notas você já tem = ")) for c in range (0, jnotas): notas1 = [] n =…
-
0
votes1
answer159
viewsManipulating an object that is present inside an Arraylist
I need to do some operations of combinatorial analysis with information present in objects, but I do not know how to extract them from ArrayList. I need to remove the content present in the variable…
-
0
votes1
answer615
viewsMean between vectors within functions (python)
Good afternoon guys, I have the following code: def Ler_vetor(): VET= []*10 for i in range(0,10): VET.append(int(input('Digite um número: '))) return VET def Escreva_vetor(VET): print('Dentro do…
-
0
votes2
answers313
viewsFill list and finish python loop
I need help on a problem that asks me to fill in by adding data to a list until it is declared 'end'. E=[] i=0 E.append(input('Nome do elemento?')) while (i!=fim): E.append(input('Nome do…
-
0
votes2
answers217
viewsDefault list replacement in regex
People need to turn a string into a list, in a peculiar way. I found in this post what I need to do. But I’m lost on the regex applied. I have numerous string in the following format: ["DECRETO Nº…
-
0
votes2
answers522
viewsRemove function in one list alters elements in another Python3
def almostIncreasingSequence(sequence): x = sequence for i in range(len(x)): sequence = x cont = 0 y = False sequence.remove(sequence[i]) for j in range(len(sequence)): try: if sequence[j] <…
-
0
votes1
answer54
viewsUnchanging collection adding strings
I’m starting java programming and I’m having a problem creating an immutable collection. Below is what I created: package br.com.estudos; import java.util.Collection; public class…
-
0
votes3
answers75
viewsWhy is my code "swallowing" string on a list?
letras = ["A", "B", "C", "B"] vogais = ["a", "e", "i", "o", "u"] for letra in letras: if letra.lower() in vogais: print(letra.upper()) letras.remove(letra) elif letra.lower() not in vogais:…
-
0
votes1
answer266
viewsTable in Python
Good night, I need to make a Python function that receives a list of tuples with real dollar and real dollar dollar quotations return a string that, when printed, generates a table of quotations. I…
-
0
votes1
answer52
viewsAs popular dropdwonlist with datetime AM value and another dropdwonlist with PM C#
Question: As popular a dropdownlist worthwhile datetime AM and other dropdownlist with PM value in C#. private static void FillTimeDropDown(DropDownList dropDownList) { TimeSpan startTime = new…
-
0
votes4
answers140
viewsHow to print more than a maximum number of a list
Guys the exercise of my college is as follows: Write a program that receives the names of 5 students and put in a list and their respective notes in another list. The exercise asks to print the…
-
0
votes1
answer544
viewsSimple Chained List
I’m having trouble removing an item at the end of the list Defining the knot: class Node { Node proximo; int chave; Node(int chave) { this.chave = chave; } } Simple Chained List: class ListaLigada {…
-
0
votes3
answers1665
viewsmultiples of 2 and 3 in python
I’m making a code to compute the first(s) n(s) multiples of two values, and put it in a list. until ai perfect but in the list occurs multiple equal numbers, as could take the equal number from the…
-
0
votes1
answer441
viewsHow to get the index comparing two lists of different lengths in Python?
I have two different lists in two CSV files. The first list has 47843 items and the second 813331, which is the first multiplied by 17. I want to take the index position in the first, based on the…
-
0
votes3
answers105
viewsDoubt about Python list
The problem is to make a function that receives a list, and returns True if any of the elements are repeated, or False otherwise, without modifying the original list. I made an algorithm, but it is…
-
0
votes0
answers16
viewsArgument does not support iteration. How to resolve?
I am trying to apply zip to the x, y and z lists, but when running the program I get the following error: izip argument #1 must support iteration. Can someone help me fix my mistake? from…
-
0
votes3
answers228
viewsCompare two lists in python and return matches
How to compare (old-fashioned) 2 lists in python and return the matches of these two lists
-
0
votes1
answer61
viewsHow to sort items from a list using two different values?
I have a list, which contains several values, each group of values corresponds to an audio of a language, however I am not able to sort using two conditions. audio_list = [{640: 640, 'lang': u'en',…
-
0
votes2
answers67
viewsHow to relate two lists, obtaining the value of one through the maximum of the other?
I’m stuck in an exercise asking for an X number of teams participating in a championship. In the later lines is typed the name of the team and its score. In the output, the team that made more…
-
0
votes6
answers342
viewsGet a list of the first multiples of a number
I need to do a program that determines the first 5 multiples of 3, and I wanted to put the values of the first 5 numbers into a variable, but I don’t know how to do that. I tried to make: for index…
-
0
votes1
answer978
views -
0
votes4
answers197
viewsPython, how to calculate the average of a list of 5 in 5 elements?
I have a problem where I need to calculate the average of 5 out of 5 elements in a list, for example, average the first 5 elements, then average the next 5 elements and so on. I tried using list…
-
0
votes1
answer425
viewsHow to delete items in an array? (Python 3)
I need to build a program where the user will be able to delete events from the event schedule, but the problem here is that when he deletes another event,I mean, after he has deleted the first one…
-
0
votes3
answers5733
viewsHow to save the output result of a Python script to a txt file?
Script showing saved wifi passwords: import subprocess data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8', errors="backslashreplace").split('\n') profiles =…
-
0
votes0
answers45
viewsComplexity of Strand Sort algorithm
I’m using the Strand Sort to do a college job and wanted to know if at level of complexity, in worst case it O(n 2). and I wanted to know under what circumstances it would be better to use this…
-
0
votes0
answers19
viewsLoop to search Twitter for various elements of a list using tweepy
I am using tweepy to return 20 tweets from each user in INF_LIST. I’m trying to do this by way of a loop so that it covers all users. However, it seems that the program returns only the last user’s…
-
0
votes1
answer60
viewsXOR operation by filtering my list values in Dataframe columns
I have several lists and a single dataframe, my goal is to filter my columns that contain the same values from my list and create a dynamic XOR operation. When you find my XOR result equal to 0, the…
-
0
votes1
answer40
viewsHow do I guarantee unique numbers on a list of lists?
Good evening, I’m trying to make a 5x5 bingo card, using Andom to generate the values, however there can be no equal numbers. I tried to do it that way but it still comes up equal numbers: import…
-
0
votes2
answers39
viewsScroll through a string list and display the 2 in 2 result
in a certain part of the code, I need to go through a list with string values. However, the display of these values needs to be 2 in 2, instead of 1 to 1. I am using Python version 3. Example…
-
0
votes2
answers58
viewsInsert at the end of efficient-list
typedef struct NODO{ int custo; int linha; int coluna; struct NODO *nseg[2]; }Nodo; Nodo * insertLastEfi(Nodo *L,Nodo *nv){ Nodo * aux =L; if (L==NULL) { return nv; } while (L->nseg[1]!=NULL) {…
-
0
votes0
answers36
viewsHow to count occurrences of a number in a matrix?
I need to do a function that counts how many times a number appears in a matrix, example: ocorrencias(9,[[9,7,6,9,8,8]]) Must return 2 My code: def ocorrencias(numero,matriz): cont = 0 for elemento…
-
0
votes1
answer38
viewsI have a question about how I can add each item of 2 lists and play the results of the sum to a third in python
I have the following program #Faça um programa que percorra duas listas e gere uma terceira sem elementos repetidos. x = [] y = [] z = [] while True: n = int(input("digite um número(0 sai): ")) if n…
-
0
votes0
answers64
viewsHow to multiply all values within a list?
Hi, I’m developing a program that gets a list of bases and exponents. Thus, it performs the potentiation between them and, soon after, multiplies the results. However, I am dubious about the…