Category "list"

use function to the items in list

originally, beaker is instance and the function below is possible. beaker.replace(z=10) I made a list of beakers bk = [beaker1, beaker2, beaker3] and I want al

How to use Map.computeIfAbsent() in a stream?

I have a fun puzzler. Say I have a list of String values: ["A", "B", "C"] Then I have to query another system for a Map<User, Long> of users with an attr

How to append a multiple dictionaries to a list from a loop, python?

How can one append dictionaries that each looping generates to a list so at the end my function returns a list of n-dictionaries? Without any fancy libraries, j

List changed in a function [duplicate]

I'm supposed to rotate the list iteratively which means put the first element to the last, and the rest move forward until it back to the orig

How to take a tuple of two lists from user input?

How to take a tuple of two equal-size lists from user input at a bash terminal from within a python script? Let's assume we want the program to register the fol

Proving a simple list function applied four times is the identity

The following video contains a mathematical card trick due to Colm Mulcahy: https://www.youtube.com/watch?v=dHzUQnRjbuM The key operation in the trick is define

How to use grep to search for patterns matches within a list of data frames using a second list of character vectors in R

I have two lists in R. One is a list of data frames with rows that contain strings (List 1). The other is a list (of the same length) of characters (List 2). I

How to find the frequency of words in a list created from a .csv file

I am trying to write a program that first reads in the name of an input file and then reads the file using the csv.reader() method. The file contains a list of

more concise way to make this?

I'm unsure of how to create a certain section of my code without it being excessively long and tedious. Is there perhaps a way of utilizing a range function whe

write each result of the loop to a python list

I have the txt file as follows: 0 1 2 0 // 7697 909 1 // 3536 4921 2 // 1421 6919 3 * 9805 -8620 4 + -862 -5869 ... ...

This is the case for List in my StatefulWidget

Flutter import 'package:country_house/pages/Country.dart'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; class AllCountries extends St

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