Posts by Danilo • 447 points
41 posts
-
1
votes0
answers80
viewsQ: Redirecting the root URL to a directory . htaccess
I have the following domain: https://aulasprofdanilo.com.br When accessing it it is possible to observe that it directs to the following screen (see below): In order to access my teaching platform,…
-
1
votes1
answer177
viewsQ: Draw picture centered vertical line
I am working with Python image processing using the PIL and Matplotlib library and I am not succeeding in the following purpose: I have the image below. I would like to draw on it a vertical and…
-
1
votes1
answer216
viewsQ: Sort 2D vector in descending order
I have the following vector: a = [['UK', 'FR', **numero**], ['UK', 'NL', **numero**], ['UK', 'PT', **numero**]] Where the variable number are floating point values and different. Wish to sort vector…
-
0
votes1
answer240
viewsQ: Moving files in folders
I have a folder called test. Inside this folder there are 1000 subfolders from 1 to 1000. Within each of these subfolders there is another folder called Reports Inside each folder Reports there is a…
-
4
votes3
answers288
viewsQ: Search for tuple in an array
I have the following vectors: a = [('FI', 'SE'), ('SE', 'DK'), ('DK', 'DE'), ('DE', 'PL'), ('PL', 'BY')] b = [['NL', 'DK', 0], ['NL', 'DE', 0], ['NL', 'BE', 0], ['FI', 'SE', 0.054]] I need to go…
-
0
votes0
answers25
viewsQ: Changing vector-specific positions, determining random and equal values
I have the following vector: [**17, 17**, 1954, 909, **17, 17**, 411, 844, **17, 17**, 1954, 909, **17, 17**, 411, 844] As noted, the indices [0,1]; [4,5]; [8, 9] and [12, 13] are equal. I need to…
-
0
votes1
answer150
viewsQ: Simulate area of action of points in matplotlib
I need to create a graph where, given the coordinates of the points, an x-ray circle is created around these points. Simulating the area of action. I have the following script:…
-
0
votes1
answer320
viewsQ: Sum indices of a vector respecting condition
I have the following code: import random usuarios = 2 APs = 2 distancias = random.sample(range(0, 100), usuarios*APs) teste = [sum(distancias[x: x + usuarios]) for x in range(0, len(distancias),…
python-2.7asked Danilo 447 -
1
votes1
answer459
viewsQ: Update table with the highest value from another table in Mysql
I have a table called employees, with the following fields and values: nome salário a 10 b 100 c 30 d 40 I have a second table called function_more_caro, with the same fields as the previous one,…
-
0
votes2
answers240
viewsQ: Concatenate items into a vector
I have the following vector, which I obtain after consulting a database: a = ['[[10, 20], 10]'] When I try to access their values through the indexes, I can’t. For example, if you type:…
-
0
votes1
answer253
viewsQ: Insert Data Tuple into same database cell
I have the following script: import pymysql cobertura = (10, 20) base_de_dados = pymysql.connect("localhost", "root", "senha", "base_de_dados") cursor = base_de_dados.cursor()…
-
0
votes1
answer45
viewsQ: Identifying the most effective method of identifying the central element of a matrix
I have the following algorithm: import numpy as np matriz = np.array(np.zeros(81).reshape(9, 9)) for i in range(1, matriz.shape[0], 3): for j in range(1, matriz.shape[1], 3): matriz[i, j] = 255…
-
0
votes1
answer55
viewsQ: Identify repeated indices and exchange only one of them
I have the following vector: a = [1, 2, 3, 4, 1, 3] I need to go through this vector and identify which values are repeated. After identifying them, I need only one of them to be exchanged for a…
-
0
votes1
answer200
viewsQ: Indexerror: image index out of range using PIL
I’m starting to work with image processing and need to do a simple exercise to double the size of a. I have the following script: from PIL import Image imagem = Image.open("local_da_Imagem", "r")…
-
0
votes1
answer476
viewsQ: Traverse a vector to a given number of indexes and form a list of values
I have the following vector: a = [10, 10, 10, 10, 10, 20, 20, 20, 20, 20] I need every five indexes to form a list of these elements. You’d look like this: b = [(10, 10, 10, 10, 10), (20, 20, 20,…
-
1
votes2
answers42
viewsQ: Iterate indexes of a vector
I have the following vector: a = [10, 20, 30, 40...] I need to create a new list that is the subtraction of the second index by the first, the third index by the first and so on... Then the third…
-
0
votes3
answers50
viewsQ: Determine the indices of a vector to be subtracted
I have the following vector: a = [10, 20, 30, 40, 50, 60...] I need to create a new list that is the subtraction of the later index by the previous one. For example: b = [indice[0] - indice[1],…
-
0
votes1
answer44
viewsQ: Correlate vectors through the index and assign different values
I have the following vectors: posicao_1 = [4, 62, 24, 18, 47, 62, 63, 78, 68, 87, 24, 18, 6, 8, 12, 17] posicao_2 = [43, 61, 21, 19, 46, 63, 68, 72, 66, 89, 29, 10, 8, 7, 6, 15] I need to search the…
python-2.7asked Danilo 447 -
2
votes1
answer100
viewsQ: Create a 2D vector from a 1D vector in Python
I have a vector with the following values: a = [10, 20, 30, 40, 50, 60, 70, 80] I need to create 2D vector with these values. For example, it would have to look like this: b = [[10, 20], [30, 40],…
-
0
votes1
answer340
viewsQ: Correlating vectors through the Python indexes
I have the following vectors: posicao_1 = [4, 62, 24, 18, 47, 62, 63, 78, 68, 87, 24, 18, 6, 8, 12, 17] posicao_2 = [43, 61, 21, 19, 46, 63, 68, 72, 66, 89, 29, 10, 8, 7, 6, 15] I need to search the…
-
0
votes1
answer2324
viewsQ: Locating values in a python array and assigning specific values
I have the following vector: posicao = [47, 62, 24, 18, 47, 62, 63, 78, 68, 87, 24, 18, 68, 87, 63, 78] I need to search in this vector the values [24, 18]. After locating them all, I need to assign…
-
1
votes1
answer70
viewsQ: Correlating values in Python Arrays
I have a vector called POSITION, with the following values: position = [40.51, 30.52, 30.31] I have a vector called COORDINATES, with the following values: coordinates = [10, 20, 30, 40, 50, 60, 70,…
-
1
votes1
answer89
viewsQ: Relation between Python Arrays
I’m a beginner in Python and I’m having a hard time doing the following: I have 1 vector with the following values: heading = [34.53, 32.64, 44.20, 43.41] These values are given by the Euclidean…
python-2.7asked Danilo 447 -
0
votes1
answer69
viewsQ: How to include Labels in matplotlib
I have the following code: import matplotlib.pyplot as plt AP_X = [10,20,30,40] AP_Y = [50,60,70,80] plt.scatter(AP_X, AP_Y, color="green") plt.ylim(0, 100) plt.xlim(0, 100) plt.show() It displays a…
-
0
votes3
answers1847
viewsQ: Calling PHP file in HMTL form
I want to call a. PHP file, but I can’t. I have this script: ======== <html> <header> <title>Home Page</title> </header> <body> <form method="post">…
-
1
votes1
answer1289
viewsQ: Warning: mysqli_query() expects Parameter 1 to be mysqli, integer Given
I have this code below: <?php $conecta_no_banco = require_once ('conecta_db.php'); $login = $_POST['login']; $senha = $_POST['senha']; $sql = mysqli_query($conecta_no_banco,"SELECT usuario FROM…
-
0
votes1
answer219
viewsQ: Google Maps API
I have the following situation: The geographical location of my country is: longitude de 73°59’32 (A OESTE) longitude 34°47’30 (A Leste) latitude 5°16’20 (Ao Norte) latitude 33°45’03 (Ao sul) I’m…
-
1
votes1
answer249
viewsQ: Reuse of Python functions
I am a beginner in programming and I have the following situation: I have a class called TEST. Within this class has the function RANDOM. I have a second class called CHECK. Inside this class has…
python-2.7asked Danilo 447 -
3
votes2
answers6824
viewsQ: Automatically create vector in Python
I’m new to Python and need help with the following: I have a variable (x) that takes an integer value. I want this variable to be used to create a vector with 1 row and (x) columns. This vector must…
-
1
votes1
answer5762
viewsQ: Unboundlocalerror: local variable 'adversario_1' referenced before assignment
I have the following code: def aleatorio(): from random import random a = random() return a def torneio(): canditado_1 = aleatorio() while canditado_1 <= 0.5: canditado_1 = aleatorio() if…
python-2.7asked Danilo 447 -
7
votes4
answers16556
viewsQ: Generate random numbers in Python without repeating
I have the following situation: I have a vector with 4 indexes. In each index a random value is generated from 0 to 100. I have a code that does this perfectly, but sometimes the numbers repeat.…
-
0
votes1
answer83
viewsQ: Ignore certain indices in a Python list
I have the following situation: I have a list of 64 items and I want the first two values to be displayed and all the other ones after 2. An example would be: lista =…
-
1
votes1
answer2952
viewsQ: Typeerror: list indices must be integers, not tuple
I have a code that calculates the Euclidean distance between two points. However, when executed it presents the error: "Typeerror: list indices must be integers, not tuple" I don’t know what I’m…
-
0
votes1
answer36
viewsQ: Interacting all items on a list
I have the following situation: I have 4 numerical lists ranging from 1 to 30. Ex.: AP_X = [1,2,3,4,5...30] AP_Y = [1,2,3,4,5...30] demanda_X = [1,2,3,4,5...30] demanda_Y = [1,2,3,4,5...30] I have…
-
1
votes1
answer18
viewsQ: Display a certain vector in a 2D list
I have the following problem: I have a 2D vector and wish to display only the first vector ([250, 27.65863337187866, 93.38094023943002, 27.65863337187866]). I wrote a code, but it’s showing…
-
2
votes1
answer880
viewsQ: Create a Python list copy so that they are independent
I have the following situation: I have the list 1 with the following values [10,20,30,40]. I want to create a copy of this list, but I need the list_2 not to change when I modify some value of the…
-
0
votes1
answer100
viewsQ: Python Random.getstate function
I need your help in the following situation: I have a loop that generates a random value from 0 to 400. I need my function to return at which time the loop generated the number X. (For example, loop…
-
3
votes2
answers202
viewsQ: Displaying certain vectors in a 2D Python list
I have the following situation: - I have a variable called (vector_distances). This variable receives a 2D list with several vectors. - I wish it to be displayed, only vectors whose sum of their…
-
2
votes1
answer53
viewsQ: Displaying certain values in Python
I need help with the following: I have a variable that generates random integer numbers from (0 to 400). In a given number of executions, I wish(m) to be displayed(s) the value(s) and the…
-
0
votes1
answer750
viewsQ: Typeerror: 'float' Object is not iterable in 2D CHOICE function
I have the code below and I can’t make it work. For, I need an array from my 2D list to be chosen randomly with the CHOICE function and perform the sum of values that are less than 85.0 and subtract…
-
1
votes2
answers418
viewsQ: Browse 2D list in Python
I have the code below and I want to go through and display item by item from that list. However, I cannot do this because the entire list is displayed. I ask for your help. lista =…