Questions tagged as 'python'

2
answers

List of square roots

How can I make a function that receives a n parameter, which returns a list of the first% of% square roots using higher order functions in Python. As shown below: [sqrt(1), sqrt(1)+sqrt(2), sqrt(1)+sqrt(2)+sqrt(3), ...] I've tried...
asked by 08.04.2017 / 22:08
1
answer

MP3 player with Python

I do not know almost anything about programming and so I've been studying new possibilities, like POO and the like. Recently it gave me a willingness to try to learn Graphical Interface and also to create an MP3 player, all this in Python (all y...
asked by 10.05.2017 / 16:38
1
answer

How to update the value of a variable?

I made a function in which it has an initial variable and according to which the user marks a checkbutton it takes this value stored in the variable and then takes and verifies the value of it and deletes the previous value puts the current valu...
asked by 19.05.2017 / 00:31
1
answer

Calculation of distance on Earth: URI - 1721 [closed]

I would like to know how to calculate the distance between points on Earth given latitude and longitude. Which formulas use to convert spherical coordinates to Cartesian and vice versa. I need help to solve a URI problem: link #URI - 1721...
asked by 16.08.2017 / 18:14
3
answers

How to execute the method inside a .py file by the terminal linux

How can I call a method that is inside a .py file directly from the Linux terminal, but I do not want to enter the prompt of the python For example [fedora@user ~]$ python arquivo.py metodo parametro Something like% Django / P...
asked by 15.08.2017 / 22:42
1
answer

Access dict within list

How do I access the dictionary where it contains the Portuguese language from the list below? To access the key: variavel.foreign_names , but I would like to get the values that are inside the dictionary with Portuguese language (the di...
asked by 16.01.2017 / 18:52
1
answer

Dictionary, separate values and keys in two lists

I have the following dictionary: abc = {'y': 'Y', 'b': 'B', 'e': 'E', 'x': 'X', 'v': 'V', 't': 'T', 'f': 'F', 'w': 'W', 'g': 'G', 'o': 'O', 'j': 'J', 'm': 'M', 'z': 'Z', 'h': 'H', 'd': 'D', 'r': 'R', 'l': 'L', 'p': 'P', 'a': 'A', 's': 'S', 'k'...
asked by 02.06.2016 / 11:03
1
answer

Error in code sum beginning with 0; Problem inserting data into .txt file

As you can see in the code below, I tried in several ways to make each inserted product a new code with codigo += 1 , but it is returning:    UnboundLocalError: local variable 'code' referenced before assignment! Placing this line a...
asked by 24.08.2018 / 15:44
1
answer

How to know what is the PID of a Python script currently running?

I have a certain Python script that I want to know what the current PID is through the script itself. How can I do this? Through this too, can I determine that it runs only once?     
asked by 22.03.2017 / 15:20
2
answers

How to open file separating each line in an item from a list / tuple?

In PHP, we have a function called file which, when opening a file, causes each line to be placed in an item of a array . Example: hello.txt olá mundo php script file('hello.txt'); // array('olá', 'mundo') I...
asked by 23.03.2017 / 17:51