Questions tagged as 'python-3.x'

3
answers

Average student error

I developed the following algorithm to calculate student mean: matricula = int (input("Digite a matrícula do Aluno: ")) nota1 = float (input("Digite a primeira nota do aluno: ")) nota2 = float (input("Digite a primeira nota do aluno: ")) no...
asked by 12.10.2018 / 17:34
3
answers

Remove elements from a Python Parameter List

Basically I want to remove elements from a secondary list based on the result of another list. I have two lists: lista_8 = ['', '', 'Preco', '', 'Preco', '', '', 'Preco'] lista_n = ['positivo', 'positivo', 'negativo', 'positivo', 'ne...
asked by 31.10.2018 / 18:39
2
answers

How to assign values to an undefined number of variables in python?

To assign values to multiple variables it is only to follow this structure: a, b, c = 1, 2, 3; This I know, but what if for example I want to store multiple values that came from an input without knowing the amount of values? How do I do that?...
asked by 03.01.2019 / 02:35
1
answer

Find the largest string using Python

I have the following code: import collections num = int(input('Digite um número inteiro: ')) #Inputar número inteiro binario = bin(num)[2:] #Cortar o 0b sequence = binario collection = collections.Counter(sequence) print('O número binár...
asked by 12.12.2018 / 13:53
0
answers

Could not parse the remainder: '[1]' from 'i [1]' in Django

I'm trying to do a check to modify the bootstrap component according to the status id, but it returns me this error:    Could not parse the remainder: '[1]' from 'i [1]' in Django The error code snippet is as follows: {%for i in cli %}...
asked by 08.01.2015 / 13:01
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
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
1
answer

Array Split twice Python

I need to get coordenadas cartesianas and separate them, so that you know which pair is ordered. I get a string where the points come this way: x0,y0 x1,y1 ... xn,yn I used a% w / o for space first and then an array for comm...
asked by 04.10.2018 / 05:54
2
answers

"for" with step "float": TypeError: 'float' object can not be interpreted as an integer

I want to loop from 0 to 100 with step 0.1: for x in range(0, 100, 0.1): a = cos(radians(x)) But I get this error:    TypeError: 'float' object can not be interpreted as an integer How can I loop through step float?     
asked by 08.10.2018 / 20:06
1
answer

Export a dictionary to .txt file

Hello. I'd like to know how I can export a dict to a .txt file. and how to import the data that is in the .txt file into the dictionary in the program. When I import, the dictionary gets all bugged, how do I import it correctly?     
asked by 28.09.2018 / 04:17