Category "list"

Check if a list is defined and avoid the "UNDEFINED" error

In the original TI-BASIC (for TI-83/84+) is there a way to check if a list has been defined? Currently calling dim(⌊LIST) will return an error if the lis

Pythonic way of checking if a condition holds for any element of a list

I have a list in Python, and I want to check if any elements are negative. Specman has the has() method for lists which does: x: list of uint; if (x.has(it &l

Getting the index of the first occurrence of a given element in a given list

I am trying to implement the following specification: busca.v.xs = <Min i : 0 ≤ i < #xs ∧ xs.i = v : i> I wrote something like the following. b

Find first and last value greater than 0 in a list in python

It is a list based on a solar measurement system so in the first hours of the day it will be 0 and in the last hours of the day it will be 0, so I am interested

Unpacking lists within a data frame into multiple TensorFlow inputs

So I have a pandas data frame similar to this: col1 col2 col3 [0,1,0] 1 0 [1,0,0] 0 1 and I want to unpack it so that it becomes 5 columns as apparently tenso

How do I access index from filter in java?

I'm planning to convert the following without a for loop and using functional programming: int count = 0; for (int i = 0; i < 5; i++) { //Feedback: avoid for

Plotting nested lists seperately, which are inside nested dictionaries

I have a list consisting of multiple nested dictionaries and nested lists MyList = [{dict0}, {dict1}, {dict2} ... {dict2422}] dict0 = {'type': 'Feature', 'geom

(Java) How to map one column of a CSV file to another column of a different type?

So for this problem, my function is supposed to return the top-10 list of avengers with the most appearances (in decreasing order). In the Avenger class it is

How to transform a list to an array in kotlin

I have a list val rewardList: List<Reward> class Reward( val nameBefore: String
 val amountBefore: Long ) I want to have val rewardArra

Dart: why is a list or map not equal to [] and {} respectively

void main() { var a = []; var b = []; print(a == []); print(a == b); var c = ['c']; print(c == ['c']); var d = 'd'; print(d == 'd'); } fa

Dart: why is a list or map not equal to [] and {} respectively

void main() { var a = []; var b = []; print(a == []); print(a == b); var c = ['c']; print(c == ['c']); var d = 'd'; print(d == 'd'); } fa

How can I create a two dimensional array with each element being a list in Java?

I want to create a two-dimensional array, each element of which is a list, as in the image. I tried ArrayList<List<User>>[][] arrayList = new ArrayL

Get the index of the unique item only

I have a list of colors as shown in the expanded code screenshot below. The list will always have 4 color values, but only one of them will be different than ot

How to print data if only matching string found in list?

key_word = ["apple","Apple","Boy","boy"] title1 = "Where the boy" title2 = "The Boy playing cricket" title3 = "hello world" title4 = "I want to buy apple vine

How to convert the elements of a python list of lists?

I have a python list (vals) containing lists of strings like this: [['540.0 ', '0.0 ', '0.0 ', '162.0 ', '2.5 ', '1040.0 ', '676.0 ', '28 ', '79.99 \r'], ['54

printing a board in python

I'm trying to create a chess game in python without uses pygame I know I'm not so far to finish it but I have a problem, I don't achieve to print my board in a

Menu Item does not break like but pushes one word over the other when re-sizing window

It's probably something small, but I cannot figure it out. When resizing the browser window, the string in the list items don't break onto a new line. (see imag

Mean calculation between dataframes in list in R

I have a list of dataframes that all have the same format (same number of rows, same number of columns and columns have the same name). I would like to create a

Prolog: replace the nth item in the list with the first

I'd like to have a Prolog predicate that can replace the nth item in the list with the first. Example: % replace(+List,+Counter,-New List, %-First Item). ?- rep

Comparing lists with order

I wish to compare lists and output the similar matches that following each other in the same order. list1 = ['a','b', 'b', 'c'] list2 = ['b', 'a', 'a', 'c'] #