Questions tagged as 'python-3.x'

1
answer

Web application for script monitoring

What is the best way to monitor script execution? I have a script.py that needs to be running "infinitely", and I'd like to know if it's running or not. I would like a web application to do this monitoring, and if it closes, I can run it through...
asked by 20.12.2017 / 19:53
1
answer

Matplotlib python normalize y-axis

I'm trying to normalize the y-axis of this plot, when I say normalize and leave on the same scale import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec import numpy as np from matplotlib.legend_handler import HandlerLine2D...
asked by 04.01.2018 / 01:57
2
answers

Recursion in Python 3

I'm having trouble organizing a recursive sum formula in Python. I need to calculate: My code: def seq1(n): if n == 1: return n return seq1(n-1)+(-1**(n+1)/n) I get the same error for almost every change: Recursio...
asked by 02.01.2018 / 22:38
1
answer

How to detect specific text in a string

I want to make a program that detects if it has a specific "text" in the input entered by the user. In this example, the "text": 100 I want it to detect this 100 (regardless of position) in the input. Example: test100 or 100test I want...
asked by 24.01.2018 / 23:57
1
answer

How can I replace an error with a print without closing the program? Python 3

If I create a variable with an input that only receives integers (int) and put other types of numbers or even letters, it will generate an error and the program will terminate. I would like to know if you have a way to replace the error with...
asked by 04.01.2018 / 20:42
1
answer

Get declared variable in the function outside the decorator

I tried with the module inspect but could not get the result. The concept is: "scan" a file through a decorator . Steps Capture variable file before function read_file will be called "Scan" file Return...
asked by 17.12.2017 / 15:17
1
answer

Sorting and sequencing data from a file

I've developed a program that stores a list of ids, so Butforthedesiredpurposes,thedatashouldtakethesequentialform,sothatthefirstpairofidsissomethinglike:"889926212541448192" becomes 1 and "889919950248448000" becomes 2. That is, the file to...
asked by 23.11.2017 / 19:46
3
answers

Python - Problem with variable

I do not know where I'm going wrong, but I wrote the following line of code: #variaveis globais fcfs = False #commands def fcfscheck(): fcfs = not fcfs Supposedly this function should toggle the value of fcfs between true and f...
asked by 25.11.2017 / 22:03
1
answer

List manipulation with dictionary within a loop in Python

I have a list of lists, in which the internal lists contain words and each internal list represents the words of each different file. lista = [['carro','barco'],['moto','aviao'],['bike','skate']] ie the position lista[0] repr...
asked by 09.11.2017 / 14:59
1
answer

Find set of numbers in a list that together add X

I need to do a program where I have a list of numbers (1571.48 | 327.53 | 286.60 | 349.50 | 517.67 | 247.00 | 882.73 | 274.00 | 237.50 | 301.00 | 973.50 | 288.75 | 347.50 | 326.81), and I need to find in the middle of this list numbers that do n...
asked by 22.11.2017 / 06:49