Category "list"

Initialization of multiple empty lists in Python

What is the correct way to initialize a bunch of variables to independent empty lists in Python 3? >>> (a, b) = ([],)*2 >>> a.append([2,3]) &g

How to reshape the flutter (dart) list

Iam working with tflite library which requires an array with shape of [1, 150, 3] and i have 3 arrays of [150], when i try to make a list of the 3 list it shape

How to print a worded list line by line

Just wondering how I can print a list variable containing names, name by name line by line so its one name per line, e.g.: Luka Andrew Jay Lola The code I'm usi

How to generate a list with only two 1s and other 0s of the given length?

I have to generate lists that consist of 2 '1's and other elements are '0's. I tried the following code but it does not work: count([], _, 0). count([X|T], X,

Dictionary appends to same parent

I am trying to append to the parent but Python doesn't append to the parent. data = [(33, 'paypal.com', 'Alexa Pages'), (33, 'paypal.com', '404 Pages'), (32, 's

How can I join strings within a list in Python? [closed]

I have the following list: values = ['A', 'C', 'B', 'D'] Is there a way I can get it to output the list as the following string? result = 'AC

Given a list of strings, return characters that appear in more than one string

I'm trying to implement a function which receives a variable number of strings and returns characters that appear at least in two strings: test_strings = ["hel

How to make a List a hyperlink?

I'm working on a link list and I can't get the List to be a hyperlink <ul> <a href="pdf/VPN.pdf" target="_blank"></a> <li>VPN</li>

How do I create a list containing new data frames from an existing data frame?

I have a csv file containing 5 columns, 225 rows containing my data. The columns pertain to the experiments' Subject_ID, treatment (9 types), replicate(5), time

Fast concatenation of bytes() in python3

I have an array of byte-strings in python3 (it's an audio chunks). I want to make one big byte-string from it. Simple implementation is kind of slow. How to do

Check if value inside the list in dictionary values [duplicate]

Lets say I have a dictionary: dict = {'A': ['one', 'two'], 'B': [3, 4, 5, 5, 6, 7, 8, 9, 10], 'C': [11, 12]} I want to check if some value is

How to convert list of Hex values into Ascii string in python?

I have a list of Hex value variables in my python code. I need to convert into ASCII string. Can someone please suggest to me, how to convert it? HexList = [

Split list by sum of sublist items

I have a list of sublists with file names and sizes. I need to split that list into sublists based on the criteria that each splitted sublist must have a total

How to print all the unique combinations of a list?

list_a = [1, 2, 3] I want to print all the unique combinations from the list like this [ [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3] ] Note: Without usin

How to access a class object inside a list when a value for one of the class attributes is given in Python?

I have a list of class objects and I want to know how can I print a particular class object inside the list given a value for one of its attributes. Here is my

Code in Python that count repeated elements and return the item repeated most times and how many times

I have a list with integers, I need to find which item repeat the most, then the function should return two variables (value, number) value is the repeated elem

Raku list addition operator `Z+` 'fails' unless one of the lists is forced

I'm struggling to understand why the zip-add Z+ operator does not work on some cases. I have some 2-element lists that I'd like to sum. These work as expected w

python list No displacement

I have a list [{'sender': '0', 'recipient': '15839597-107f-4166-aff1-ac32d3794748', 'amount': 50}] and call this list elsewhere for create sha256 but list item

How can I access and iterate through an ArrayList of Linked list element?

I am trying to write a code of adjacency list implementation of the graph ADT. private ArrayList<LinkedList<Integer>> adjLists ; but I don't know

How do you print an entire row of a list made of words?

I have simplified my question where I just have a 2x2 list of words. I'm trying to print an entire row but it evidently doesn't work the same as with a list of