Questions tagged as 'python'

1
answer

Arrange string based on numbers

I'm learning to program in Python and for this I make challenges that I encounter on the internet in order to better fix each method, function etc. This challenge consists of creating a function that orders a string in which each word has a numb...
asked by 10.03.2016 / 14:53
4
answers

How to print multiples of N in a range?

The program should receive three N, A, and B values as input, and should print the multiples of N contained in the interval between A and B. I am doing this, but it is going wrong: N = int(raw_input()) A = int(raw_input()) B = int(raw_input())...
asked by 04.04.2016 / 14:01
1
answer

installing Django in a venv

I'm trying to install the latest version of Django (1.9.6) in my virtualenv, but when I use the pip install django command inside the virtual environment, I get the following return: Requirement already satisfied (use --upgrade to upgrade): dj...
asked by 01.06.2016 / 21:13
1
answer

How to add fields dynamically in Django?

I'd like to add fields dynamically in DjangoAdmin. Models.py file: class Book(models.Model): title = models.CharField(max_length=100) def __str__(self): return self.title class Author(models.Model): name = models.CharFiel...
asked by 13.01.2016 / 18:57
1
answer

Problem compiling python in pyqt libraries, with py2exe

I'm trying to compile with py2exe , but when I'll compile from the error. I will give an example of this error, with the programs Python 2.7 64 bits, pyqt4 for Python 2.7, and py2exe for Python 2.7. Follow the example: Crea...
asked by 03.02.2016 / 01:24
1
answer

How to protect image files and ini files?

I'm developing software in Python and I'm using .ini files and images. Does anyone know a way to protect these files from editing users? I do not want the user to be exchanging the images of the program and etc or changing the file .ini...
asked by 29.12.2015 / 22:00
1
answer

Read txt with numbers and create a dictionary in Python

Good afternoon I'm trying to create a graph from a Txt file but in the generated dictionary the numbers are coming out as if they were strings someone can help me, it follows the code: File txt ' 0 1 1 2 1 4 1 5 2 3 2 6 3 2 3 7...
asked by 07.12.2015 / 17:23
1
answer

Primal numbers using Threads in Python

I need to create a program in python using threads that find the largest number of prime numbers in 60 seconds, but I can not understand the use of threads for it: ' import time import math def is_prime(number): number = int(number)...
asked by 09.11.2015 / 19:29
1
answer

How to implement a linear regression algorithm in python?

I'm running a job in college and would like to implement a function that calculates a regressão linear . Given the points and the number of desired exponents, I want as a return the coefficients of the equation. For example, given the poin...
asked by 05.11.2015 / 23:35
1
answer

list index out of range

Tsup=[] Te=0 dt=1 t=range(0,3600*2,dt) r=len(t) for i in range(0,r): Tsup.append(20) .... Tsup.append( (((Pj[i]+Ps-Pc[i]-Pr[i])*(dt))/((m_al*c_al[i])+(m_a*c_a[i])))+Tsup[i] ) if i==r: Te=(((Pj[i]+Ps-Pc[i]-Pr[i])*(dt))/((m_al*c_al...
asked by 18.02.2016 / 13:36