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?
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...
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...
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...
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...
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...
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?
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...
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.
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,...