Questions tagged as 'python'

2
answers

Print list within another list

I have the following statement:    A teacher takes measurements of the heights of his students in his class.   For each of the 10 students, take the measurements twice a year.   We will make a program that allows us to enter 10 height values...
asked by 03.06.2018 / 17:23
1
answer

Print large values with format

As an example, if I have f=10000000 print(f) >>>1000000 but what I'm looking for is that instead of printing 1000000 I printed 1'000,000 I would like to know how I can get what I want. Thanks     
asked by 19.03.2018 / 16:31
3
answers

Add the value of a list of dictionaries with the same key

I have a list of dictionaries lst = [ {'x': 1, 'y': 2}, {'x': 1, 'y': 3 }, {'x': 2, 'y': 2 } ] Dictionaries always have the same keys and it is the values that change at all times. Then I would like to add the value of the keys "and" whe...
asked by 07.02.2018 / 11:58
1
answer

For loop with if and elif in a line

of this question link I managed to paint a graphic with different colors depending on an "annotation" binary array. The problem is that now I want to use three colors and I do not understand the for loop too well. I've tried it with an elif -a...
asked by 25.06.2018 / 12:42
1
answer

ImportError at post / new when creating a form with Django

I'm starting at DJango and I have some doubts about the forms, here's the code, I'd appreciate your help: D This is the error that appears: Directories and files: blog |--_pycachce_ |--migrations |--static |-...
asked by 15.01.2018 / 18:23
1
answer

What kind of queryset can I do, to order type of strategy in conservative, moderate and risky?

This is my class: class FirFondoDistribucionAdmin(admin.ModelAdmin): """ Administrador de las distribuciones de dichos fondos """ list_display = ('fondo', 'tipo_distribucion', 'porcentaje', 'is_activo', 'fecha') admin.s...
asked by 03.07.2018 / 18:46
1
answer

Browse lists within a python dictionary

If I have this dictionary with python : {'143534':[23,12,45],'123765':[33,89,90],'148987':[98,65,80]} I need to place a matrix like this: 23,33,98 12,89,65 45,90,80 Any suggestions?     
asked by 05.07.2018 / 00:09
1
answer

Problem in the function call in Python 3

I have a code in python 3 and it gives me errors in calls to defined methods. My code: import hormiga import tareas class Colonia: def __init__ (self, tareas, n_iteraciones, evaporacion=0.1, n_hormigas=20): self.__constanteEva...
asked by 03.02.2018 / 14:35
1
answer

How to update django in visual studio?

Hello, I have all installed version 2.0.2 of django and it works fine, but I have noticed that when creating a project with visual studio, version 1.9 appears, I am very confused and I would also like to develop a project created with cmd in vis...
asked by 02.02.2018 / 04:11
1
answer

Return a queryset from request data

I have the following model: class Actividad(models.Model): nombre = models.TextField() es_principal = model.BooleanField() fecha_inicio = DateField() fecha_fin = DateField() dirigente = TextField() And this is your vi...
asked by 19.01.2018 / 15:07