dynamic

Python: how to dynamically add a number to the end of the name of a list

Python: how to dynamically add a number to the end of the name of a list Question: In python I am appending elements to a list. The element name I am getting from an input file, so the element_name is an unknown. I would like to create a new list by adding a number to …

Total answers: 3

How do i make a image in the code to change position by itself?

How to animate the position of an object or sprite in Pygame and move it towards predefined positions or along a defined path? Question: I learned how to print image in pygame, but I don’t know how to make a dynamic position(It can change the image position by itself). What did I miss? Here’s my …

Total answers: 1

Finding minimum number of steps to reach (x,y) from (1,1) : we can increment number by using condition (x,y+x)or(x+y,x)

Finding minimum number of steps to reach (x,y) from (1,1) : we can increment number by using condition (x,y+x)or(x+y,x) Question: a = 1 b = 1 x=int(input()) y=int(input()) def minsteps(x,y): if x==a and y==b: print(1) return 1 if x<a and y<b: print(2) return 20 count = 1 + min(minsteps(x,x+y),minsteps(x+y,y)) return count print(minsteps(x,y)) Test case: (3,2) …

Total answers: 3

Process columns based on column names in another column

Process columns based on column names in another column Question: I like to select cells for processing by choosing column names contained in a different column. For clarity, input and output are given below. Column ‘a’ contains the column names for setting the value to None for each row. I tried to code as below …

Total answers: 1

Can I implement a class method dynamically in Python?

Can I implement a class method dynamically in Python? Question: In Python, it’s no secret that you can implement attributes of an instance of a class dynamically. Here’s what that looks like: class MyClass(object): def __getattribute__(self, name): if name == ‘dynamic_attribute’: return "dynamic attribute value" return super().__getattribute__(name) # Create an instance of my class obj …

Total answers: 1

What Python technologies do I need to scrape Binance Margin Data?

What Python technologies do I need to scrape Binance Margin Data? Question: I want to acquire the Borrow Limits in the Isolated Margin accounts for all the coins listed on this page https://www.binance.com/en/margin-fee. The page is dynamically generated (I’ve heard Selenium is the way to go with this kind of page) but also all the …

Total answers: 1

number of path grid problem Python, Memory Error and Recursion Error:

number of path grid problem Python, Memory Error and Recursion Error: Question: so i tried to solve a simple grid problem and i solve like this : def grid_count (n,m): if m == 1 and n == 1: return 1 if m == 0 or n == 0: return 0 return grid_count(m-1,n) + grid_count(m,n-1) and …

Total answers: 2

Pytest – dynamic resolution of fixtures' dependencies

Pytest – dynamic resolution of fixtures' dependencies Question: I cannot find a solution to alter fixtures dependency in any different way than this bellow. The problem is that I need to determine the dependencies basing on pytest.config.getoption argument, instead of what’s used here (variable resolved at module level). I need to get two modes of …

Total answers: 2