Questions tagged as 'array'

1
answer

Send variable from html to php

I have the following code <tr> <td> <?php echo $mostrar['nombre'] ?> </td> <td> <?php echo $mostrar['tel'] ?> </td> <td> <?php echo $mostrar['celular'] ?></td> <...
asked by 23.05.2018 / 22:40
3
answers

Matrix MxN, fill vector with matrix values.

import random n = int(input("Ingrese el numero de fila: \n")) m = int(input("Ingrese el numero de columna: \n")) #a = n*m matriz = [] for i in range(n): for j in range(m): matriz[i][j] = random.randint(0, 100) print(matriz) I h...
asked by 28.04.2018 / 04:48
1
answer

Help with error in a for cycle to obtain a value of an array

I have an array: array = [[1,2,3],[4,5,6]] and I want that with one cycle to print on screen only 2 and 5, for that I did: for i in array: print(array[i][1]) but then I get the following error:    TypeError: list indices must be...
asked by 04.03.2018 / 21:14
2
answers

Go through an array with a FOR loop

I'm trying to repeat N times an array with a FOR loop, but I've been stuck in the last array that contains more elements. This is my code so far. $datos = array(); for ($i = 1 ; $i <= 50 ; $i++) { $medidor = 'medidor'.mt_rand(1,99);...
asked by 12.03.2018 / 16:25
1
answer

Does Vala have associative arrays?

I'm trying to find a way to create associative arrays, such as dictionaries in Python:    dictionary = {"key1": value1, "key2": value2} How can I implement it in Vala? or if there is no other solution that would be more practical. Than...
asked by 25.03.2018 / 01:34
2
answers

Sort an array by specific letter

I used asort to order an associative arrangement of words for a search box, I opted for it to avoid changing the order of the keys, the problem is that when making the search the first letter entered by the user should appear Among the fi...
asked by 06.02.2018 / 00:13
2
answers

Object Arrangement in Java

Good morning, it turns out that I must make an arrangement that can store both data as int, String, boolean and in turn any other type of object that is entered. I was using the ArrayList since it gives the option to save whatever it is in each...
asked by 07.02.2018 / 14:58
3
answers

Determine the closest number, within the array, to the given number

Good I have this problem: from an array and a number determine which number of the array is closest to the number. I do not get it public static int masCercano(int[] numeros, int num) { int cercano = 0; for (int i = 0; i < numero...
asked by 12.06.2018 / 02:36
2
answers

Filter array of objects in Javascript

I have the following array of friends: friends = [ {id: 1, name: "uSUARIO2", username: "usuario1"}, {id: 2, name: "uSUARIO2", username: "usuario1"}, {id: 3, name: "uSUARIO3", username: "usuario1"}, {id: 4, name: "uSUARIO4", username: "...
asked by 31.01.2018 / 01:12
1
answer

Filter elements of an array in php

my question is how to filter elements of an array, in this case I want the notes% co_from% to 6 to be filtered, my array is simple: array:7 [▼ 0 => 1 1 => 2 2 => 4 3 => 10 4 => 7 5 => 5 6 => 10 ] Once filt...
asked by 12.12.2017 / 02:03