Questions tagged as 'python'

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
1
answer

How to store multiple values read from the user?

aluno = int(input('Qual o numero de alunos ? ')) for i in range(aluno): nota = float(input('Insira a nota de cada um dos alunos: ')) I need to know how I store student grades to add and divide by the number of students entered into the pro...
asked by 25.10.2018 / 22:39
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
2
answers

Calculate the sum of a range of numbers entered by the user

   Read 15 numbers entered by the user and calculate the mean of the values between the x and y positions (inclusive). I started trying to do ... numeros = [] for i in range (1, 16): numeros.append(int(input(f"Digite o {i} Número: ")))...
asked by 16.10.2018 / 20:01
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
2
answers

How to know which variables are defined?

Is there a function that returns the name of the variables defined in a Python instance? Something similar to the command who in MatLab that returns the names of the variables defined by the user.     
asked by 04.08.2017 / 18:17
1
answer

Saving past data - Django

My question is as follows, in my application I have a Profile template that has the following fields: Models.py: class Perfil(models.Model): nome = models.CharField(max_length=255, null=False) pontuacao_total = models.FloatField(max...
asked by 02.04.2018 / 00:49
3
answers

code to return divisors and compare common ones

I am trying to create a code that returns me the common divisors between 2 variables that receive integers. And then show the common divisors. To return the divisors I am using this code to test: import numpy as np def divisores(num): n =...
asked by 18.03.2018 / 23:02
2
answers

Return pieces of an iterable

Implement a generator function, chunker , which gets an iterable and returns a piece of specific size at a time. Using the function like this: for chunk in chunker(range(25), 4): print(list(chunk)) should result in the output: [...
asked by 19.04.2018 / 16:21
2
answers

Change string Python

I am doing a program to sort the entered numbers (I can not simply use a sort algorithm), searching vi that can not change strings in python, have any way to do this? Or maybe use list instead of string? entrada = "32415" for i in range(entra...
asked by 18.09.2018 / 03:31