Questions tagged as 'python'

1
answer

Button does not call function correctly

from tkinter import * class Application: def __init__(self, master=None): self.inicio = Frame(master) self.inicio.pack() self.msg = Label(self.inicio, text="Deseja exprimentar a versao input?") self...
asked by 07.06.2017 / 21:43
1
answer

Sort Python Data Frame (Pandas) on two levels

I have this DataFrame and I want to organize it first by name and then by year, that is, sort it in two levels. How can I do this? Country Name Country Code Indicator Name Indicator Code Ano Pobreza 0 Aruba ABW Pop...
asked by 17.08.2017 / 22:39
1
answer

Update values of a chart using Django

I'm joking on a solo project to make a website to show the current coffee quote along with a line graph of the daily variation of that price as a function of time. I get the price of coffee making "webscraping" (yes, I know it's not cool but...
asked by 08.06.2017 / 17:07
2
answers

taylor series in python without angle and margin of error

Hello! I need to mount a program that calculates sine, cosine, and exponential of taylor series in Python, but the program can not accept an angle value, just the x, the number of terms in the series, and an acceptable error. I tried to do this...
asked by 03.06.2017 / 17:45
1
answer

AssertionError: b 'Working with test classes in Django (TDD)

I'm starting my test studies with Django and am getting an error where it apparently should not, so much so that the description of traceback makes me pretty confused. I have a class that tests if the return of my view is compatible with its...
asked by 02.06.2017 / 05:02
1
answer

Django runserver does not work

The command: python manage.py runserver 80 Returns the following: (Pus screenshot, because the text is defaced here) The localhost address is inaccessible regardless of port (8080, 8000, 80) As far as I understand, it's a char...
asked by 15.07.2017 / 18:10
2
answers

Classes within classes (Python / Django)

Hello, I'm starting to study about python because of Django. I have a doubt that many may consider trivial but I do not know the answer. I'm building a Template with the following features: class Candidato(models.Model): nome =...
asked by 07.07.2017 / 19:11
1
answer

How does this recursive function (factorial function) in Python behave?

I do not understand how the code behaves after it exits the recursive function on line 7, fat = n * fatorial(n-1) , that is, how the code assigns the value to the variable n of that line and how to calculate that line where the code...
asked by 31.05.2017 / 17:42
1
answer

Problem with my game of Forca - Python

print("*** Jogo da forca ***\n") print("*** Feito por Igor! ***\n") palavraSecreta = input("Entre com a palavra secreta: ") letrasDescobertas = [] percorrer = 0 contador = int(input("Entre com o número de chances: ")) for i in range(len(palavraS...
asked by 21.05.2017 / 04:31
1
answer

How to get the current user in the Django model?

Hello, I am creating an application in django and I have a model with the NewDemand class in which I need when the user creates a demand, the face name is saved in a field. Here's my class: class NewDemand(models.Model): name = models....
asked by 12.06.2017 / 17:03