Questions tagged as 'python'

1
answer

Problem in Django send_email function

Good afternoon! I have the following code in views.py: def email(request): if request.method=='POST': form = ContactForm(request.POST) form.email = request.POST.get('email', '') form.subject = request...
asked by 01.03.2018 / 17:19
1
answer

Python: Clean html code

Using python, what would be the easy way to clean tag parameters from Microsoft tools? Initially I'm trying to turn via beautiful soup, but I'm open to any suggestions! : D In this way: <p style="text-decoration: underline;">Hello...
asked by 22.02.2018 / 10:07
3
answers

What is the function of "try" and "except"

Can anyone tell me what the try: and except means? I need to do a program and I have a question about this.     
asked by 20.07.2018 / 03:19
2
answers

Make a count in relationship Many to Many

I'm trying to put in a view the number of students enrolled in a course using the following Models below. I can not change the columns of the Models, since the database already exists and I'm just making another system from it. But how doe...
asked by 10.01.2018 / 12:02
1
answer

Binary Tree with In-Order and Pre-Order

I have some doubts about the course taken by this binary tree: Could you classify it as binary? Since it has knots with 3 sheets? T=(35,(80,(7,(11,(12)),(15,(6,(0),(1),(2)),(9))),(3,(18),(8))),(73,(13),(27),(61))) Would it be correct...
asked by 04.01.2018 / 19:22
3
answers

Syntax error in Python code. Which is? [closed]

print("**************") print("Seja Bem Vindo") print("**************") numero_secreto = 65 chute = input("Digite um numero:") print("Você digitou: ",chute) if numero_secreto == chute print("você acertou") else print("Você errou, Tente no...
asked by 16.12.2017 / 00:41
2
answers

How do I access a private attribute in a class?

Write a banking program that you have: Uma classe Banco com os atributos - private total - public TaxaReserva - private reservaExigida E métodos - public podeFazerEmprestimo(valor) --> bool - public MudaTotal(valor) And a class has attr...
asked by 01.04.2018 / 22:49
2
answers

How to write a book in alphabetical order of names, if the dictionary structure has no order?

Write a program that receives as many entries as you want and then create a new contact for each entry (Name, Phone, Address, Email), and Finally, print the contact list in alphabetical order: Nomes = [] Telefones = [] Endereços = [] Emails =...
asked by 31.03.2018 / 01:21
1
answer

Calculate the Cartesian product with functional programming

I am writing a function in Python that gets two lists and returns a list of tuples with the Cartesian product of the input function. I can not use any function from the Python library. Ex: print(cartesiano([1,2],[11,22])) # [(1, 11), (1,22)...
asked by 01.04.2018 / 01:23
2
answers

Find the problem of my list of objects in Python

Well, I'm asking you this question, since I've tried several ways, but I can not find the error in logic or the wrong use of some syntax in python. It would be as follows, I have this class: class PalavraIndices(object): def __init__(self...
asked by 08.10.2017 / 04:27