Questions tagged as 'python'

2
answers

Media in lists with dictionaries

I have 2 lists of dictionaries and 1 dictionary, such as the following: lista1 = [ {'Idade': '8', 'Especie': 'Gato', 'Nome do Animal': 'Felix'}, {'Idade': '57', 'Especie': 'Tartaruga', 'Nome do Animal': 'Michelangelo'}, {'Ida...
asked by 24.04.2016 / 16:54
1
answer

Why does this instance variable never assume False value?

When running the following code, the variable _order_stability never gets False, even when I try to force it during the debug. The variable can assume other values, for example of type int that are different from 0 and 1. Whe...
asked by 25.10.2016 / 02:57
1
answer

Calculation to buy fuel by value?

I'm doing a fuel pump program using classes, but I'm not sure how to calculate the amount of fuel for the value entered, can anyone give a light? class BombaCombustivel(): def __init__(sel, tipoComb, valorLitro, quantComb): self.t...
asked by 01.11.2016 / 00:02
1
answer

How to add new encodings in python?

I'm trying to install pybraces but I can not. How do I install it? I'm using python 2.7 and windows 10     
asked by 17.10.2015 / 14:55
2
answers

Run a dict until empty in Python

I would like to go through as long as a list composed of values and keys is nonzero, just add values (values) in a list? The code I have is this: hey = ['item1', 'item2', 'item3', 'item4'] print("hey", hey) lol = [32, 54, 56, 64] print("lol",...
asked by 15.07.2016 / 21:16
1
answer

Search with OR in Django

Hello, I'm developing my 1st application in Django and I'm having difficulty with more complex DB queries. Here's my MODEL: class Tag(models.Model): objects = GChartsManager() idtag = models.IntegerField(db_column='idTAG', primary...
asked by 17.06.2015 / 00:07
2
answers

Questions about the use of BeautifulSoup

My code below is to get the genre of movies from the IMDB site, however I'm not sure how to get the specific tag of genres from the site, because sometimes instead of catching the genre it gets the keywords tag, get the first div he think...
asked by 26.11.2018 / 01:53
1
answer

Minimum value of each Python array column

import numpy as np X = np.random.rand(4,3) print("X: \n", X) XMin = np.zeros((1,3), dtype=np.float64) for j in range(3): print("X[{0}]: {1}".format(j,X[j])) minimo = np.amin(X[j]) print("minimo: ", minimo) np.append(XMin, minim...
asked by 26.11.2018 / 02:31
1
answer

Calculate the number of even numbers in a tuple recursively

I need help to create a recursive function that finds and adds the even elements of a tuple, I would greatly appreciate the help. def conta_pares(t): '''conta_pares : tuplo -> inteiro recebe tuplo de inteiros e devolve o numero de ele...
asked by 17.12.2018 / 16:32
1
answer

Save words with python accents

I have this json file: {"certa": 1, "vez": 7, "quando": 13, "tinha": 6, "seis": 7, "anos": 6, "vi": 4, "num": 4, "livro": 3, "sobre": 6, "a": 47, "floresta": 1, "virgem": 1, "hist\u00e3\u00b3rias": 1, "vividas": 1, "uma": 31, "imponente": 1, "...
asked by 18.12.2018 / 23:04