Questions tagged as 'python'

2
answers

Compare Python index-independent lists

Good afternoon, I need to compare 2 lists and when a certain value in the 'name' field of list 1 does not exist in the 'name' field of list 2 perform some function. The way I did is comparing index by index and executing if every time the...
asked by 08.08.2018 / 22:49
1
answer

how can i make a russian roulette in simple python

I wanted a simple scrip where it counts up to 6 using while or another replay method. and will have a list with 5 flawed and 1 died and he counts up to 6 raffling this list and when he speaks died he wanted her to look like. but in my script it...
asked by 04.05.2018 / 01:58
2
answers

How to get only numbers in parentheses in Python with regular expression

Texto = "54 oz (163 g)" I want the result to be only 163     
asked by 09.04.2018 / 05:41
2
answers

Linear Regression with python

I need to do the linear regression calculation, but I read that there is no possibility to use / install scipy on windows. Are there any other libraries similar to scipy for this type of calculation? Or if there is some way to install scipy on w...
asked by 07.05.2017 / 01:05
2
answers

Problem with lists - Python [closed]

I can not do:    The ages and heights of 5 students were noted. Make a Program that determines how many students over 13 have height   less than the average height of these students.    Final Code: idadeAlunos = [12,13,13,15,16] altura...
asked by 25.05.2017 / 19:22
1
answer

How to do searches inside the code in Python

Hello, I would like to make a code that when I type, for example, "product_name", it will check if there is any word with the name that I typed and return a value, example "200 reais". But I have no idea how to start, I'll be grateful if anyone c...
asked by 28.05.2017 / 18:48
1
answer

How to delete an entry from a Python file without having to read the whole file?

I have a file with the following entries: Ana Joao Pedro José .... I need to delete the line with the name Pedro, it would be easy for me to read the whole file, save it in a list, delete Pedro and rewrite the file: nomes = open('nomes.tx...
asked by 04.01.2018 / 14:31
2
answers

Problem using print to show function result

I'm creating a function that shuffles and returns the typed word, but I do not know how to use print (if that's the case) to show the result of the function below: def f(): a = [] x = 0 while x < len(word): a.appe...
asked by 21.01.2018 / 21:50
2
answers

Why can not variables in the same instance be read in different processes? (Python)

I have two processes going on and I have a class containing a method that modifies a value, as you can see in the code below. The ButtonObject function represents a click, to modify a value. But the question is, why does the change only occur wi...
asked by 23.01.2018 / 11:26
1
answer

Remove repeated integers list in Python

I would like to remove repeated integers from a list and return a new list. lista = [1, 2, 3, 3, 3, 4, 5, 6, 6, 7, 8] The result would have to be this: [1, 2, 3, 4, 5, 6, 7, 8]     
asked by 11.01.2018 / 18:41