Questions tagged as 'python-3.x'

1
answer

Difference between iterable objects, iterator and containers in Python 3

I have seen that in Python 3 there are iterable objects, objects iterator and there are also containers . My questions are: What is the difference? Can everyone walk in a loop? In all of them can its elements be accessed through indexes?...
asked by 08.07.2017 / 02:40
1
answer

Error with Sorted Python 3

Good, I have an error when ordering. I pass the method and the error it gives. I modified the Sorted line and it does not give me any errors so I guess the error is there def selection_and_reproduction(poblacionNueva): puntuados = [(calcularF...
asked by 12.07.2017 / 18:14
2
answers

replace items in nested lists in python

I want to replace items in lists of lists to draw a cross. So for example the list: x="X" lista =[[x," "," "," ",x],[" ",x," ",x, " "],[" "," ",x," "," "],[" ",x," ",x, " "],[x," "," "," ",x]] for l in lista: print (" ".join(l)) re...
asked by 06.08.2018 / 06:30
1
answer

Perform operation when detecting the change in a QtableWidget item

I have a QTableWidget , of 3x5 in the item (5, 5) I do the sum of the number that enter inside the item (1,2) and (1,3). Currently I need the user to click on a update button to be able to perform the update but I would like to know i...
asked by 01.09.2018 / 20:42
1
answer

Delete part of a set of tuples that form an array

Good, we are doing a small program in Python and we want to eliminate the first element of the different nested lists. The code is this: puntuados = [[calcularFitness(i), i] for i in poblacionNueva] #Calcula el fitness de cada individuo, y lo...
asked by 25.07.2017 / 17:31
1
answer

Distance between LineString and point

I have the following LineString Line = [(-58.39323087479187, -34.64522852285068), (-58.39493519860744, -34.64593911202303), (-58.39540370387294, -34.64612018963881), (-58.39577715270643, -34.64624297063709), (-58.3961720086682, -34.6463673530...
asked by 14.03.2018 / 13:07
1
answer

Query database with SQLAlchemy

I am trying to apply a query to a table, using the ORM sqlalchemy in a database already created with mysql, with the following code: eng = create_engine("mysql+mysqldb://host='localhost', user='root', passwd='...',port='3307', database='Nomina...
asked by 08.08.2017 / 01:00
1
answer

Find adjacent cells in a matrix

I'm having trouble finding and verifying the cells adjacent to a certain position within the matrix (one cell can have 8 adjacent cells). The matrix is composed of a list of chains. So far I have tested the following but it does not exceed as...
asked by 14.04.2017 / 03:15
2
answers

Clean the console after each execution of the main while

Good friends. The fact is the following, I have a small code of the game hanged, nevertheless every time that its main function is executed it goes advancing downwards leaving the previous action above as it is typical in the terminal. I would l...
asked by 20.05.2017 / 02:42
1
answer

Error running Cython - unable to find vcvarsall.bat

Good! When I try to run a file with Cython I get the following error: G:\>python setup.py build_ext --inplace running build_ext building 'VF_n' extensión error: Unable to find vcvarsall.bat I'm using Python 3.5.1 on Windows 7, 64 bits...
asked by 14.05.2016 / 21:28