python-3.x

task from eolymp with bad condition

task from eolymp with bad condition Question: I have a task to solve a rather interesting problem from the eolymp site, here is the link: https://www.eolymp.com/en/problems/7342, please solve the problem 100% in Python and drop the code in your answer. I have gone through many options to solve this problem but it is too confusing …

Total answers: 1

Why are few Testcases of finding Valid BST are failing here in python?

Why are few Testcases of finding Valid BST are failing here in python? Question: So, I am trying to find ,Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follows: The left subtree of a node contains only nodes with keys …

Total answers: 1

ImportError: cannot import name 'deprecated' from 'typing_extensions'

ImportError: cannot import name 'deprecated' from 'typing_extensions' Question: I want to download spacy, but the version of typing-extensions is lowered in the terminal: ERROR: pydantic 2.3.0 has requirement typing-extensions>=4.6.1, but you’ll have typing-extensions 4.4.0 which is incompatible. ERROR: pydantic-core 2.6.3 has requirement typing-extensions!=4.7.0,>=4.6.0, but you’ll have typing-extensions 4.4.0 which is incompatible. Installing collected packages: typing-extensions …

Total answers: 1

Column-wise sum of nested list

Column-wise sum of nested list Question: Is there a more pythonic or more simple way to accomplish this? I am taking the column-wise sum of items in a nested list. I have a working example but I’m sure nested loops are not the way to do. There has to be something, maybe in NumPy or …

Total answers: 1

How do i convert string percentage into float

How do i convert string percentage into float Question: I am using a tkinter GUI with the yt-dlp library, when approaching to make a progress bar, I get a problem to conversing the str hook into a float I have this string "x1b[0;94m 0.0%x1b[0m" that I need to turn in to a float into this: …

Total answers: 3

MyPy linting conflicting typing with typing.Self

MyPy linting conflicting typing with typing.Self Question: During linting and rewriting of an immutable class, operations do not pass the mypy checker. The class implements operations such as__add__, however, every function that returns a new instance of the same class triggers a typing error Incompatible return value type (got "Point", expected "Self") [return-value]mypy(error) Methods I’ve …

Total answers: 1

Find and move specific words in filenames

Find and move specific words in filenames Question: i have the following problem, there are files with the following names: 1234_43v5_2ws4.bsw.3r5_3d5_9z5 here is only the .bsw. is important everything else is subject to change. There is a main folder, e.g. C:/Data/Main; in the Main folder there are different folders that have different names and in …

Total answers: 2

Process the python dictionary to remove undesired elements and retain desired ones

Process the python dictionary to remove undesired elements and retain desired ones Question: I have a python dictionary as given below: ip = { "doc1.pdf": { "img1.png": ("FP", "text1"), "img2.png": ("NP", "text2"), "img3.png": ("FP", "text3"), }, "doc2.pdf": { "img1.png": ("FP", "text4"), "img2.png": ("NP", "text5"), "img3.png": ("NP", "text6"), "img4.png": ("NP", "text7"), "img5.png": ("Others", "text8"), "img6.png": ("FP", …

Total answers: 3

Static files won't load

Static files won't load Question: I`ve created a new Django project and ran into a problem with static images. So, apparently when i was connecting my css and javascript files with static it worked well, but when i tried to connect images they won’t load. here is my settings.py STATIC_URL = ‘/static/’ STATIC_ROOT = os.path.join(BASE_DIR, …

Total answers: 1