Posts by Patrick Amaral • 88 points
16 posts
-
0
votes2
answers113
viewsQ: Problems with Reactiveforms at Angular
Hello, I’m having a hard time finding a solution to my problem so I’m here, I’m trying to create a search field on my page, it’s not doing the research, but it’s not returning any errors in the…
-
0
votes1
answer279
viewsA: Dijkstra Algorithm - How do I change the reading of the txt file in C to be identified in int and not string?
When you are calling the function g.dijkstra() it needs two whole parameters, one for origin and one for destination g.dijkstra(origem, destino). And in your case you are only sending a value that…
-
0
votes2
answers1130
viewsQ: Problems with using include in Django
I’m having trouble with the include function, according to the Django documentation, the syntax is include(module, namespace=None), include(pattern_list),include((pattern_list, app_namespace),…
-
0
votes1
answer147
viewsQ: Django Rest Framework with Images
Well I’m still studying this framework, I researched a little tried some ways but did not work. Error: 'Unboundlocalerror at /api/servicos/1/ local variable 'Service' referenced before assignment'…
-
0
votes1
answer244
viewsA: Crossing lists in python
I managed to solve my problem, in fact it was very simple, I was using the setitem in the list, then as the code to modify were together and when changing the first the second would use it already…
python-3.xanswered Patrick Amaral 88 -
1
votes1
answer244
viewsQ: Crossing lists in python
Good evening, I’m breaking my head to find the error, is the following I’m crossing this list of binary numbers, the first crossing is working but the second is getting the end of the first, to…
python-3.xasked Patrick Amaral 88 -
1
votes2
answers329
viewsQ: Python: conditions for various symbols
I have a doubt, I remember having seen somewhere the resolution but I’m not finding more. So the problem has several symbols for example simbolos = ('!','?',',','\'') here it is like tuple which is…
pythonasked Patrick Amaral 88 -
1
votes4
answers725
viewsA: Function that returns the element with more characters from a list
Well, I believe you’re comparing list sizes so you have to get the size of the larger variable): def func6a(lista): maior = 0 for el in lista: if type(el) == list: maior = func6a(el) else: if…
pythonanswered Patrick Amaral 88 -
1
votes1
answer63
viewsA: list index out of range, genetic algorithm
Good for anyone who wants to use problem solving, I solved it was a logic problem. Fixed code: def selecao(fitness, populacao): populacaoIntermediaria=[] somatotal = sum(fitness) probSelecao = []…
pythonanswered Patrick Amaral 88 -
0
votes1
answer63
viewsQ: list index out of range, genetic algorithm
I’m having trouble with the line you’re on parcial += pacum [i-1] I am with the error "list index out of range", about the variables and lists: list population and fitness depend on the…
pythonasked Patrick Amaral 88 -
-1
votes1
answer181
viewsQ: Fill a list
I’m in need of help, I’m developing a genetic algorithm, well my problem is that I need my loop to not stop as long as there’s room on the list. As for example I have a population of 10 already…
pythonasked Patrick Amaral 88 -
0
votes1
answer181
viewsA: Fill a list
This way I was able to solve, so he fills the entire list with the drawn numbers. def selecao(fitness, populacao): populacaoIntermediaria=[] somatotal = sum(fitness) for j in range(tamPopulacao): i…
pythonanswered Patrick Amaral 88 -
1
votes1
answer95
viewsA: Error while trying to run Scene
Check in your Scenebuilder if you are referencing your Controller class. Can be edited directly in FXML this way fx:controller="sample.Controller"
-
1
votes3
answers559
viewsA: Python - Find numbers larger than average
I believe that’s what you want. def somar_elementos(lista): soma = 0 for numero in lista: soma += numero media = soma / len(lista) maiores=[] for i in lista: if i >= media: maiores.append(i)…
pythonanswered Patrick Amaral 88 -
0
votes2
answers977
viewsA: Python - Find a tuple odd
Guy got a little confused about what exactly you want but according to your goal would do this way : lis=[] lista=[0,1,2,3,4,5,6,8,9] for i in range(len(lista)): if lista[i]%2 == 0:…
-
0
votes1
answer45
viewsQ: Problems configuring views using Jango
I’m studying Jango and I’m having problems in the following part {'posts': posts} I’m using as ide pycharm and it shows error but for me the syntax of the code is correct. from django.shortcuts…