Category "list"

How to return a position of elements in a list using only positive number?

I created a list for the user to enter a number, which is the position of the elements in the list, but it still work for negative number. Are there anyway to s

function that takes directory of .txt file and returns a dictionary based on set parameters?

I want to make a function that takes the directory of a .txt file as an input and returns a dictionary based on specific parameters. If the .txt file is empty,

How to print strings and integers in the same line?

I'm trying to print each item in the following two lists: lNames = ['John','David','Michael'] lAges = [45,14,32] with the format: "Person 0, Name: John, Age 3

How to loop vertically through a list in Python?

This is my code atm: puzzle = [ ['1','1','1','1','1','1','1','1','1','1'], ['1','0','0','0','0','1','1','1','1','1'], ['1','1','0','1','0','0','0','0','0','0'],

How to insert an element in a list after using del in python

def my_len(lst): mylen = 0 for i in lst: mylen += 1 return mylen def insrt(lst, what, where): length = my_len(lst) tmp = [0] * (len

How could I display all the text of a column in a list?

I am using share point online and there is a news list. The problem of this list is that it shows only few lines of text in the Body column. If I want it to sho

Creating an error message for an invalid input in python

I have been trying to create a program that creates a list from user input. The program is meant to give an error message to the user input when the length of t

DynamoDB: FilterExpression when querying List Type Attribute for "Contains"

I have looked all over the place and I can only find minimal documentation and examples on using FilterExpressions to filter records with a given value containe

extract attributes from list

I am a novice in python and I treat to extract emotions from list and put each attribute to its corresponding series to train machine learning algorithms for ex

Creating a new dataframe column with the number of overlapping words between dataframe and list

I'm having some trouble fixing the following problem: I have a dataframe with tokenised text on every row that looks (something) like the following index feelin

Make a list out of frequencies, concatenating categories to that list

I am trying to adapt this solution, by onyambu: New data dat_in_new <- structure(list(rn = c("Type_A", "Type_B" ), `[0,25) east` = c(1269L, 85L), `[0,25)

How to slice a nested list twice?

With a nested list like: ex_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] I need to be able to slice this list for: [[1, 2], [4, 5]] I've been trying: list(ex_list

SwiftUI List row color inconsistent while scrolling in a NavigationView

The background color of row views within a List inside a NavigationView inconsistently switch from transparent to white as I scroll.

Error: " 'float' object is not subscriptable" whenever I try to print certain values from a list of averafes

I created two variables that give the amount of words in a given context that are both positive and negative respectively within a couple of years. The followin

python 3 how to generate multiple random element in list for loops

I'm doing a coding exercise and it's to build a password generator. I understand I need to utilize the for loop with the list containing the elements but I'm ha

How to merge two lists using LINQ Suming especifics fields with sublists

Considering I have 2 list (listaProduto1 and listaProduto2), both with same properties, but with different values. I need the result merge both lists, but it mu

Subset with only consecutive numbers

I want to generate all subset of {1,2,3,4} with only consecutive numbers. (For example I want subset {1}, {1,2} or {2,3,4} but not {2,4}. ) This is what I have

how to create a dataframe from a list of dictionary value?

I have a list - elements_listed = [{'data': {'data/2022/04/1': '26-Apr-2022 07:47', 'data/2022/04/2': '24-Apr-2022 17:27', 'data/2022/04/3': '22-Apr-2022 14:20'

Removing Custom-Defined Words from List - Python

I have a dataframe column that looks like: I'm looking into removing special characters. I' hoping to attach the tags (in list of lists) so that I can append t

tail recursion count, split & get the prefix of a list functions

Language: Scala I'm working on some tail recursion questions in Scala. (GOAL) A function that counts the number of ones in a list. The function takes a list of