Category "list"

Angular typescript update class if element is in array

I am doing an APP in Angular 12. In my component.ts I have an string array[] like AccessRoles["AA","BB"] And on the other side I have a class like this export c

PHP array_diff() equivalent in Dart? (Comparing two maps and return a map of difference)

I simply want to produce the same effect that PHP's array_diff() function does in Dart, and for those who don't know PHP or this function, my apologies but unfo

How to Sort a Model Based on a Property in IList<T> within that Model

This is a bit more complex than other questions. I have a Model that encapsulates an IList. Within each IList item there are multiple Lists. This makes it VERY

Return to the list of a repository in Controller

I'm trying to return a list that is inside a Repository in my controller, but I'm not getting it. Could someone help me? This is a RESTapi for an ATM project th

Group list of objects into smallest possible number of sublists without exceeding maximum sum

I'm trying to write a method that groups objects into the minimum amount of sublists without mixing types (int field on object) or the sum of their values excee

Sum up all Floats in a List of 'Mixed' Elements

What are some primitive ways to get a sum of all floats in a list that looks like this: list_1 = [['coffee', 6.99], ['cream', 0.6], ['berries', 3.5], ['milk', 1

create a list from given data to use in read_fwf

in load_fwf the parameter colspecs assigned as a list like this example data2 = pd.read_fwf("sample.txt",index_col='Order number',names=['Order number', 'code',

Combining of two lists in python [closed]

I have two lists with elements and an empty list: l1 = [1,2,3,4,5,6] l2 = [7,8,9] l3 = [] How can I add the elements of l1 and l2 into l3, li

how to modify element of list in python

Given a list of filenames, we want to rename all the files with extension .hpp to the extension h. To do this, we would like to generate a new list called newfi

efficient way of computing a list with mean of values in another list

I need to compute a list with the mean values of another list. To be more precise, the input list have this form: input_list = ['1.538075/42.507325', '1.53796

Jetpack Compose Slider in LazyColumn changing while scroll

I have a list that includes Slider the problem is when I scroll the slider detecting the tap event and change it, see attached gif The excepted behavior is whe

How to get the values of dictionary python?

I have the below python dictionary stored as dictPython { "paging": {"count": 10, "start": 0, "links": []}, "elements": [ { "organiz

Printing a large list in multiple lines

Is there a good way to print a large list in multiple lines? Assume that a list has 10000 elements and by writing that to a file it goes all in a single line wh

Decouple dictionary that contains a list as a value for a particular key

Let's say I have a dict in Python that follows this structure: dict_a = {"a": [1,2,3]} I want to produce an output to 'decouple' dict_a in a list of 3 separate

How can I check if treeUri is empty?

I want to check if a treeUri has any files in it or if its empty, so I can delete the Folder. Ive tried listFiles but comes up with Landrodix.etc. and not the a

convert List of string array into xml

I need to convert list of array into xml. In the list the first object is the elements of the xml and from second object onwards it is the values of the element

access variables in list python

I need to acess a variable in list for example var1=[Orange,Banana] var2=[Apple,Pear] var3=[Banana,Pear] var4=[Grapes,Orange] var5=[Orange,Apple] user_fruit =

Antrl4 Listener callbacks populating Java list of classes

I am using Antlr4 v4.9.2 in Java mode. I am converting adaptation ascii text files to XML format. The parser is working great and do its job. Each element of th

Running the same code yields different results on Colab and on local. No randomization or NN training involved

My code yields different results in the local terminal and on Google Colab. However, if I run the same code on Colab but with a terminal command (i.e. !python t

Python3 merge tuples in a list and remove duplicates

There might be a similar ask to this one in the past, however wasn't able to find the one that I was looking for, Input = [('Icecream', 'Vanilla'), ('Icecream'