Posts by Lorran Rosa • 83 points
8 posts
-
1
votes2
answers147
viewsA: Filter with first item of a Manytomany Django
Corroborating Regis' response, you can do it as follows: jobs = Jobs.objects.filter(background_active=False)[0]
djangoanswered Lorran Rosa 83 -
1
votes3
answers1348
viewsA: How to calculate the median of a large amount of values?
Well, the information is a little vague and also do not know the format of the file where are these data, with this, I can give you just an idea of what to do. 1) Read the file and put the values in…
pythonanswered Lorran Rosa 83 -
0
votes1
answer123
viewsQ: Limit items in a dictionary
I am trying to analyze data from a research of own authorship, the files are already tabulated in .xlsx. format I use openpyxl. My intention at that time is to take the state of the participants +…
-
0
votes0
answers59
viewsQ: Forms in Django, help?
Is there any way to work with Forms in a practical way in Django? The point is that I am creating a site on my own and as I already knew Python, so I decided to use Django. "Everything" was fine,…
-
0
votes2
answers1301
viewsA: Calling a Python function by the text present in a variable
You can do it like this: def somar(x, y): soma = x + y print(soma) func = input('Digite a função: ') if func == 'somar': x = input('Insira o primeiro número: ') y = input('Insira o segundo número:…
pythonanswered Lorran Rosa 83 -
3
votes3
answers1265
viewsA: Ask for n python entries
I don’t know how to ask for the age of n people. How would I do that ? idade = 0 lista_com_idades = [] while idade != '-1': idade = input('Diga sua idade: ') lista_com_idades.append(idade) This is…
-
2
votes2
answers2266
viewsQ: How to find the name of the key in a dictionary by the value contained in it?
Here is an example. dicio = {'pizza': {'massa', 'ketchup'}, 'feijoada': {'feijão', 'linguiça'}} user_input = 'feijão', 'linguiça' #Input How to check if this input is in the values of this list and…
pythonasked Lorran Rosa 83 -
1
votes1
answer592
viewsQ: How to pick a value from a certain attribute with Beautifulsoup
I’m trying to write a code that takes titles from the G1 news and prints them on the screen. The problem is that G1 uses unfinished text(...), ex: <a class=(...) title="Marcelo Bretas acolhe…
pythonasked Lorran Rosa 83