Following a tutorial Poly Editor I’ve created 2 polygons, added to the figure, and then instantiated 2 interactive polygons. I expected that when I adjusted the individual polygon it would work separately. However they were conflicting with each other. Then I have tried some changes in the original code…
Python – Iterating through 2 list with arithmetic function
I have 2 python list, stock_level to track the amount of inventory and required to indicate the amount of each item in stock_level needed to create each product. How do I iterate through the 2 lists to find out how many products can be made and the inventory left outstanding after making the products i.e. giv…
Smallest Number Function
Trying to make a simple function that determines the smallest number in a list of numbers. For some reason, it looks like my for loop is only executing once for some reason with this function. What am I missing? Answer Your return statement is in your for loop. Remove the last indent of your return, and it sh…
Discord.py read list
I have a file with a list called wbanned.txt which contains forbidden words. I want every message sent to be read and if it contains one of the forbidden words in the txt list (Every word is on a new line from list) to be deleted. I tried something but all it does is delete it only if it contains
Not able to import python files needed in main.py
I have this file structure which i am not too sure is considered good practice. here is the directory structure I am trying to import the content of seed.py and wallet_generation.py into my main.py file. But when I try import the files through a relative path ie (../../bitcoinBackend/seed and ../../bitcoinBac…
Cant decode HTTP Response to JSON (Python3)
I am running a series of API tests and this one is giving me an error. As far as I can tell response.read() converts the HTTP response into binary and then decode() converts that binary into a string but it’s an empty string. When I copy paste the binary string into Python3 (b'{“error”: {…
How do I create a list as a key of a dictionary and add to the in different parts list?
I have a for loop that runs through a CSV file and grabs certain elements and creates a dictionary based on two variables. Code: I for example during the first iteration of the for loop, sf1_ticker = ‘AAPL’ and sf1_date = ‘2020/03/01’ and the next time around, sf1_ticker = ‘AAPL&…
Why Matplotlib.hist taking different list?
I’m trying to plot the following And getting This one actually draws a different array([ 1., 4., 5., 8., 9., 10., 10., 10., 10., 10.], which is created run time automatically. Answer I assume you mean the red histogram appears to be wrong? It’s not. You’ve got cumulative=True so it adds each…
How to retrieve the full branch path leading to each leaf node of a sklearn Decision Tree?
I have this decision tree, which I would like to extract every branch from it. The image is a portion of the tree, since the original tree is much bigger but it doesn’t fit well on a single image. I’m not trying to print the rules of the tree like or like: What I’m trying to achieve is somet…
Working outside of application context Flask JWT decorator issue
I am fairly new to Flask applications. While my application works for all the endpoints as expected when I tried to add jwt authorization I encountered this issue. I have tried this solution app.app_context().push() based on some other questions that have been posted. Any help would be greatly appreciated. I …