loops

Time Complexity of this program solving the coin change problem

Time Complexity of this program solving the coin change problem Question: I have created a program shown below, and I am confused as to how to figure out its time complexity. Is it O(ntarget/min(coins)) because a for loop is created each time the function is called, and the function is called target/min(coins) times? The program …

Total answers: 1

Python – run 2 loops (same function, different args) concurrently

Python – run 2 loops (same function, different args) concurrently Question: I’ve looked at many solutions but none are working for me. I have a simple function (with arg) for a while loop. I would like to run that function with arg1 concurrently with the same function with arg2. At the moment it will only …

Total answers: 1

loading multiple json files from different folders in python

loading multiple json files from different folders in python Question: I have a folder structure that looks like this: 1. data 1.1. ABC 1.1.1 monday_data monday.json 1.1.2 tuesday_data tuesday.json 1.2. YXZ 1.2.1 wednesday_data wednesday.json 1.2.2 etc I want to unpack all of these json files into a pandas dataframe in python. I have spend alot …

Total answers: 2

Kivy find out which Button called the Function

Kivy find out which Button called the Function Question: I have a List which I go through and generate a Button for each element in the List. Now when I press the Button I would like to know what Text is inside the Button. Sadly I was not able to figure out how to do …

Total answers: 1

How to check that all list elements have a minimum difference of x

How to check that all list elements have a minimum difference of x Question: I’m currently trying to iterate through a small list of integers and update any values which fail to meet a condition of absolute difference. The aim is to use this over multiple small lists as part of a much larger for …

Total answers: 5

Python: iterating through class dependants

Python: iterating through class dependants Question: from dataclasses import dataclass @dataclass class BronzeA: name = "bronze_a" quality = "bronze" dependencies = None @dataclass class BronzeAA: name = "bronze_aa" quality = "bronze" dependencies = None @dataclass class SilverAA: name = "silver_aa" quality = "silver" dependencies = [BronzeAA] @dataclass class SilverA: name = "silver_a" quality = "silver" …

Total answers: 1

how to transform strings in csv file into float and store them as a list?

how to transform strings in csv file into float and store them as a list? Question: I have csv file that looks like this: id,type,inc,a,b 1,2,63376.799999999996,0.3061,187 2,1,58087.700000000004,0.3361,178 3,1,52699.9,0.3482,181 4,2,72964.8,0.3186,177 5,4,111589.79999999999,0.268,154 6,4,107618.0,0.2583,150 7,2,87109.2,0.3233,193 8,2,84669.59999999999,0.308,179 9,2,77258.4,0.3247,173 I need to transform values from fields [3], [4] and [5] that are ‘inc’, ‘a’ and ‘b’ into float and than …

Total answers: 2