Questions tagged as 'lista'

2
answers

How to get an item from a list randomly?

Suppose I have the following list: frutas = ['abacate', 'mamão', 'laranja', 'uva', 'pêra'] I need to capture one of these elements of list randomly. How would I do this in Python?     
asked by 09.01.2017 / 19:31
1
answer

Is it possible to de-structure an array in PHP equal to or similar to the list in Python?

In Python we can de-structure a list like this: lista = [ "Maça", "Pera" ] maca, pera = lista print(maca, pera) The output will be: Maça Pera I know that in PHP it is possible to get the result using the function list $lista...
asked by 07.11.2018 / 00:26
2
answers

How to return the position of an element in HashSet?

I have the following structure: HashSet<Contato> contatos = new HashSet<Contato>(); How to return the position of a given Contact element that is contained in HashSet? I was searching and found a way to get back to the po...
asked by 08.10.2014 / 23:58
1
answer

Concatenation of two linked lists

The problem is:    Write a program and make a function to concatenate two lists of integers in a third list that should be returned by the function, in C #. My only question is how to concatenate the list. Code of the class that repres...
asked by 01.09.2017 / 12:36
1
answer

How to shuffle list of strings in C #?

I have a console application, in which the list exists: List <string> ListaFrases = new List<string>(); This list is built through the user inputs on the console. How to display your strings, but so that their positions are "sh...
asked by 03.10.2017 / 22:18
3
answers

How to transform a String made up of numbers into a list of integers?

I have a list with a string: a = ["1, 2, 3, 4"] I want to get every number within that list, turn them into integers, and return the largest and smallest value in that list. I've already tried doing this with FOR IN like this: def...
asked by 12.12.2015 / 18:59
1
answer

Transform list of strings into list of tuples

I have this: l=['Car 8', 'Bike 5', 'Train 10'] And I would like to have something like this: [('Car','8'), ('Bike','5'), ('Train','10')] How could you make a list of strings into something like a list of strings tuples?     
asked by 05.12.2017 / 01:27
1
answer

List being modified without implementation

I have a problem where the list I am working on is being modified even though there is no passing of values to it. from random import * from numpy import * m=2 lista_inicial=[[1, 2], [0, 2], [0, 1]] lista_aux = [] lista_aux = lista_inic...
asked by 14.09.2016 / 14:11
2
answers

Divide a list into n sublists

I have the following list: l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] What I need is to split this list into n sublists, in this case you can not do it manually since n is going to be dynamic.     
asked by 16.08.2016 / 23:12
3
answers

Lists within lists: even slicing, there is connection between lists

I am studying lists and behavior occurs that I do not understand. I know that when I link one list to another, a connection between them is created. And that when I use slicing a list, I create a copy of the list (no connection between them,...
asked by 04.11.2018 / 23:19