Questions tagged as 'python'

1
answer

Is it possible to translate the own messages of argparse?

I have several command-line python scripts that handle several parameters to invoke them, this I resolve through argparse , which is very simple, however this library has some messages in English (at least in python 3.4) that I would like to tr...
asked by 05.05.2017 / 17:45
1
answer

How to create a program that multiplies matrices?

I try to make a program that multiplies two matrices given by the user. What I have managed to do is this: def CrearMatrizA (m, n): return [[0.0 for j in range (n)] for i in range (m)] def CrearMatrizB (m, n): return [[0.0 for k in ran...
asked by 10.04.2017 / 02:26
1
answer

Python: Using label in Tkinter

for a program I want to place two label "Question" and "Answer" next to two text boxes. As shown in the following image: The problem is that with the following code: from tkinter import * #Creando una ventanta principal window=Tk() wind...
asked by 12.04.2017 / 01:04
2
answers

Error showing result

   Develop an application that allows you to enter the number of workers needed   for an urban work. In addition, you must ask for the salary that those workers will receive.   Once entered these data, show the total cost in that concept. After...
asked by 02.04.2017 / 21:31
2
answers

"While": how can I "print" the values of while in horizontal separated by a ","?

I would like to be able to print the values that you send me: c=int(input("Ingrese un numero:")) a=0 while(a<=c): print(a) a+=2 instead of one on each line:    > > > Enter a number:   9   0   2   4   6   8   ....
asked by 28.04.2017 / 19:26
1
answer

Python - Read list within matrix, which has been saved in text file

Greetings. I have a 16 x 8 matrix that, in turn, contains lists in some of its coordinates. I know how to send the matrix to a text file, but I can not take the data from the file and rewrite it in a new matrix as integers, respecting the int...
asked by 26.02.2017 / 02:06
1
answer

I miss an "IndentationError: expected an indented block" [closed]

In the following code: import sys if len (sys . argv) == 2 : numero = int (sys . argv[ 1 ]) if numero < 0 or numero > 9999 : print ( "Error - Número es incorrecto" ) print ( "Ejemplo: descomposicion.py [0-9999]" ) else : # Aqui va la lóg...
asked by 15.03.2017 / 03:37
2
answers

Given a text and a letter indicate how many words appear that contain that letter

I was doing this exercise, however, when I run it, I do not see the number of words that contain that letter, only a zero appears, what am I wrong with? Thank you in advance texto=raw_input("ingrese un texto: ") letra=raw_input("ingrese una le...
asked by 13.02.2017 / 02:56
3
answers

Handling an item in a list in python

We need to manipulate an entire element of a list, suppose that in this list it is like this: List = [123432, 2345321, 234554] I want to get a new number of the centers of each item from the list I mean that if the number has 5 digits, tak...
asked by 04.02.2017 / 18:26
2
answers

How to list the widgets correctly within a QLayout

Dear, I come before you with a problem that is currently bothering me. I'm trying to create a custom calendar in Qt, since the QCalendarWidget can not be modified or stylized, I'm doing my own. The problem is when I try to connect the d...
asked by 26.01.2017 / 14:51