Questions tagged as 'python'

3
answers

How to create a dictionary with a word and its adjacent one from a string?

I have the following string : texto = "We are not what we should be We are not what we need to be But at least we are not what we used to be" This would be the return I wanted: for every word in the text, it receives the word next to it....
asked by 11.07.2018 / 00:08
2
answers

Program with boolean expressions enters the if block every time

prefixes = "JKLMNOPQ" suffix = "ack" for letter in prefixes: if letter[0] == "Q"or"O": print(letter+"uack") continue print(letter+suffix) Expected response: Jack Kack Lack Mack Nack Ouack P...
asked by 06.06.2018 / 22:22
2
answers

Generate querysets from dynamically generated rules

I'd like to do a sort of filter using Django. Imagine the following case: Model: user (Name, gender, age, natal_day, birth_ month, etc.) Rule: Catch all users with Gender = M and Age > 20 The intent would be to generate rules fro...
asked by 14.05.2018 / 20:01
1
answer

Python conditional deviation

I made this code, but it does not compile. I'm using Visual Studio 2015 . # Exercicio Python 2.6 import utf8 #PROGRAMA TESTE DOS IFS #Usando Coding para assento nas Strings input ("Digite valor de A ") input ("Digite valor de B ") input ("...
asked by 05.04.2017 / 18:26
1
answer

UI Python - How to do [closed]

I wrote a simple program in Python, and I need to make a GUI for it, what are the GUI Builder options today?     
asked by 11.03.2014 / 13:22
2
answers

Encoding problems

I have a coding problem that I can not solve. I've tried several suggested things, but none works: Script: # -*- coding: utf-8 -*- import sys line = ["Oi tudo bem com você","eu GOSTO de café", "esta situação é Terrível"] def sup...
asked by 10.07.2018 / 12:48
3
answers

What's wrong with Python code ?? Bhaskara [closed]

import math def Bhaskara(): a = int(input('Digite um valor para A ')) b = int(input('Digite um valor para B ')) c = int(input('Digute um valor para C ')) #(-b +- {-b² - 4 * a * c} ) / 2 * c operacao = -b raiz = (operacao * operacao) - 4 * a *...
asked by 07.07.2018 / 19:37
1
answer

Code that calculates the days between two dates without using the datetime module

I am making a code that calculates the days between two dates, however it can not use the datetime module, and it only gives error. Here is the code: usuariodata=input() usuariodata2=input() Datas=usuariodata.split("/") Datas1=[int(Datando...
asked by 06.02.2017 / 03:42
2
answers

How to calculate the time from point A to point B?

I need to make a time control that a truck takes from a factory X to a Y reseller, in addition to calculating how long it has been in that resale. I have GPS data and I've extracted information that was relevant because it's a l...
asked by 30.01.2017 / 02:21
2
answers

How to create sublists with numeric elements that are in a sequence?

Friends, imagine a list: lista = [1, 2, 2, 3, 3, 3, 6, 6, 7, 11, 12, 12, 13, 14, 14] Would you like to create sublists with only the elements that are in sequence? For example, in this case it would be: lista = [[1, 2, 2, 3, 3, 3], [6, 6,...
asked by 10.02.2017 / 18:10