Questions tagged [list]

The list tag may refer to: a linked list (an ordered set of nodes, each referencing its successor), or a form of dynamic array. Not to be used for HTML lists, use [html-lists] instead.

Filter by
Sorted by
Tagged with
0 votes
1 answer
31 views

python: rotate an array 90 degree - but not symetric dimension

I am implementing a game which uses blocks, that contain of pixels. I want to be able to rotate those blocks. Therefore I began to use this nice line: self.array = zip(*self.array[::-1]) But as it ...
pezubi's user avatar
  • 73
0 votes
1 answer
27 views

How to remove an item from list without using the remove() method?

I want to remove the last item from the list but it's not allowed to use methods. Any ideas? <I don't want to rewrite my whole code so here we are... xd> Keres.Remove(Keres[Keres.Count - 1]); ...
Zsooo's user avatar
  • 37
0 votes
1 answer
28 views

How to return more than 1 of the same values in each row

I have a data frame with the same values in some of the rows. I would like to return the row number and values that has more than 1 of the same value starting from Num1 to Num7 in df. Also would like ...
Chris's user avatar
  • 127
1 vote
5 answers
81 views

Printing the fibonacci series upto ten elements in a python list

So, as a beginner in Python, I have been trying to solve practice problems in loops and if-else statements to get a good grip on the basics of program flow and control statements. I was working on ...
Majoka's user avatar
  • 19
0 votes
1 answer
22 views

Pascal Triangle in OCaml: Get next line as a list

I am trying to get an OCaml function which gives the next line of a Pascal's triangle as a list for example: (next_line: int -> list -> int list) let get_next_line [1;1] returns [1;2;1] and so ...
J.B's user avatar
  • 29
0 votes
0 answers
42 views

Comparing and Updating Lists with String Matching Based on Percentage in Python

In this code, the problem lies in the comparison of strings that are found within sublists that are contained within lists, and in the logic of the criterion that determines when a new string will be ...
Matt095's user avatar
  • 857
-1 votes
0 answers
22 views

Print each element of a list in Python without using loops [duplicate]

Is there a way to print every item in a Python list or tuple without iterating over it. For example, here is a sample code: my_list = ["apple", "banana", "cherry", "...
Chirag's user avatar
  • 1
-1 votes
0 answers
41 views

AttributeError: 'list' object has no attribute 'append' [closed]

I am relatively new to Python and trying to build a simple program that involves appending elements to a list. However, I am encountering an AttributeError that I can't seem to figure out. Here is a ...
Kumari Vaishnavi's user avatar
-1 votes
0 answers
25 views

I want to save the input as a link every time, but nothing happens

I am a beginner and if possible I could use some help. I want to save the input as a link every time, but when I try to put li.append(anchor) nothing happens. This is what I've tried so far const ...
KClauu's user avatar
  • 1
0 votes
0 answers
7 views

How can i Filter and also get Max value for the list

I have a List of Entity and i have to filter based on UUID which is Optional if the UUID is not passed then i need to get the Max version from the List CEntity cEntity = cEntity .stream() ...
Shanker Nayak's user avatar
-1 votes
2 answers
46 views

Looping through file with lists is returning "none" with mapping but works when I test manually [duplicate]

first time attempting Advent of Code with python and running into an issue with my loop. I've successfully been able to take the input file and break it into lists as shown below for the output.txt. I'...
justFF's user avatar
  • 1
2 votes
2 answers
53 views

How do you select the nth item in a list based on that item’s child's attributes using only CSS selectors

So if I have a list like this: <ul> <li><button disabled/></li> <li><button disabled/></li> <li><button /></li> <li><button /&...
Preston Moore's user avatar
0 votes
3 answers
42 views

How to add two vectors together to get a list in R

I am attempting to add two vectors together. How do I return all results of a vector added to another vector in list format? Like so: a = c(1:4) b = c(5:8) where expected result is the following list ...
geoscience123's user avatar
-3 votes
1 answer
55 views

List with two values in one cel [closed]

I cant seem to separate the values from the list in python. Can anyone help me how i can change it to two values in a vector or array. the Change keeps giving it Size 1 it has to be changed too 2. So ...
faried badloe's user avatar
-1 votes
0 answers
36 views

How to use a JavaScript list in Thymeleaf

I know how to use a list sent from a controller with Thymeleaf, and this by using for example : <script th:inline="javascript"> /*<![CDATA[*/ var myList = /*[[${list}]]*/ [];...
alia's user avatar
  • 171
0 votes
0 answers
40 views

How do I sort a dictionary by value by all possible ways? [closed]

To sort a list in dictionary by value in python, I want to get to know about various method to sort dictionary by value. I tried the method called or known as "Using sorted() + join() + lambda&...
Surjeet Singh Gill's user avatar
-5 votes
0 answers
34 views

I am trying to make a code tester but some fixes need to be done [closed]

I am trying to make a code tester but some fixes need to be done.. I am trying to make a code tester but some fixes need to be done..I have identified a few issues with the code tester that need to be ...
M.Srikanth Karthikeyan's user avatar
0 votes
0 answers
16 views

Need help in understanding a pseudocode aiming to insert a new element in the beginning of a linked list

I was studying about Linked Lists from the book, "Introduction to Algorithms" by T Cormen. There was an portion in the book as follows: Given an element x in the list, x.next points to its ...
Thomas Finley's user avatar
1 vote
0 answers
21 views

Optimize search of a point(latitude,longitude) in a set of polygon(state polygon)

I stored the polygon data of all the states of USA in a custom object class StateDetails: state_name :str state_multipolygon :<class 'shapely.geometry.multipolygon.MultiPolygon'> Now I ...
G_1's user avatar
  • 11
0 votes
0 answers
17 views

Miscrosoft365R - pluck list contents

I have a nested list of what appears to be a Microsft365R object called an 'R6' object. I am able to output the email contents to the console using emails[[1]] - but cannot seem to unnest this or ...
Dre Day's user avatar
  • 340
0 votes
1 answer
22 views

Need to list data from a zip archive using unzip

Listing the contents of the zip file as below: wladmin@solarishost:/tmp$ unzip -l -q /tmp/package-391.zip | awk '{ print $4 }' | sed -n '3,$p' | grep -v '^$' myapp/src/stage/bras.war myapp-...
Ashar's user avatar
  • 3,037
0 votes
1 answer
37 views

Frequency of A list in a Pyarrow Table

Find myself in an interesting conundrum, in that I need to compute the frequency of a series of lists by participant ID. Data looks not unlike the following: test_table_orig = pa.table([ pa.array([...
TDeramus's user avatar
  • 117
1 vote
2 answers
31 views

Looping over a list but using names instead of the actual objects

I am trying to use lapply to apply a function to some dataframes. I have a list containing the names of the dataframes I want to use. The problem is, that when I use lapply on the list it gives me an ...
clarrity's user avatar
-1 votes
1 answer
54 views

where is full python3 documentation located?

For lists, there is a method called insert(). Where is the documentation that tells you what happens if you try to insert an item well past the end of the list? For example: x=[] x.insert(5,10) this ...
DCR's user avatar
  • 15k
1 vote
0 answers
20 views

How to copy a R list object to Excel using the writeClipboard function while preserving the structure and all the names in the original list object?

I am using the line of code writeClipboard(gsub(" +", "\t", capture.output(print(nested_list, max = 1e6)))) to copy/paste list object nested_list to Excel. The code works fine when ...
Village.Idyot's user avatar
-1 votes
3 answers
57 views

How to remove specific common keys in a list of dictionaries?

I have a list of dictionaries: res = [{'termA':'A1', 'termB':'B1', 'termC':'C1'},{'termA':'A2', 'termB':'B2', 'termC':'C2'},{'termA':'A3', 'termB':'B3', 'termC':'C3'}] Each dictionary has the same ...
chikako's user avatar
3 votes
4 answers
98 views

Which is more efficient in python (and in general): iterate over short list and searching in the longer one, or vice versa?

I have two lists, both contain integers represented as strings. large_list is large, up to low 10s of thousands of elements. small_list is smaller, up to hundreds of elements. I am filtering the ...
skytwosea's user avatar
  • 280
1 vote
1 answer
38 views

Extracting values from lists in Netlogo

I have a model where patches have the value of "habitat" and I have a csv file of animal selection ratios. The goal is that I want each agent to survey the habitats within their next step to ...
Kilian Murphy's user avatar
0 votes
1 answer
42 views

How do i check a list (T) of tuples up against a list (H), followed by extracting +-5 of these tuples in list which corresponds with element in H)?

I haven't done much list/tuple checking and i wanted to try it. I want to extract elements from list, compare lists containing tuples and add some statement to them. count1 = 100 theCounter = range(...
Ben's user avatar
  • 1
0 votes
2 answers
63 views

iterate over all elements of a list of tuples with lists

I have a list of tuples (that again consists of lists) and would like to to check how many of the elements of the first list in the tuple is in the second list of the tuple. names =[ ([''],['aa']), (...
corianne1234's user avatar
0 votes
1 answer
54 views

Sort List of Strings by having a character Flutter

I have a List of strings ["pana", "open","peno","alp","palp"] and i need to sort them by having the letter "p", then alphabetically: so the ...
Reham Al-Ra'i's user avatar
0 votes
0 answers
29 views

SwiftUI: Change Color based on List selection background

If you choose the color primary as foreground color for text or symbol images in SwiftUI list rows that can be selected, the color will change if the row is selected, which will greatly improve ...
Daniel's user avatar
  • 1,570
-1 votes
0 answers
16 views

Duplicates Lists set [duplicate]

What's the most efficient way in Python to remove duplicate values from a list? I attempted to use the set() function to convert the list into a set, as sets automatically eliminate duplicates. ...
Muhammad Habib's user avatar
0 votes
1 answer
60 views

Can't remove some of the numbers from the list (from, to), only removes first number

array1 = [] while True: try: number = input("number('end' to continue): ") if number == "end": break number = int(number) except ...
STAYQUIET's user avatar
0 votes
1 answer
32 views

How to modify a string while preserving its original index as reference?

I'm looking for a computationally efficient way to add and remove elements from a string at will using its original index as reference. A good example I have in mind is to be able to format a text ...
sereizam's user avatar
  • 2,070
0 votes
2 answers
102 views

Is there a good algorithm to reconstruct a global ranked list from several partially ranked lists?

I have a list of objects which are being reviewed by a team of judges. Each judge only sees a subset of the objects, and each judge ranks the objects from best to worst. Each object is ranked by at ...
tomr_stargazer's user avatar
-1 votes
0 answers
61 views

Comparing 2 Lists in Python Case-Insensitive [closed]

I am pulling MAC addresses through two APIs and putting them into a list. I am then wanting to pull the MACs that are present in both lists. list1 = "['40:EC:99:0C:4D:83', '40:EC:99:0C:4D:87', '...
pandapunk94's user avatar
0 votes
1 answer
42 views

Selection Sort by alternate selection

I am solving the following code challenge: Let N be the size of a list. Implement the Selection Sort algorithm with the following modifications: In odd iterations, find the element with the lowest ...
afrodev's user avatar
0 votes
2 answers
36 views

Sort list of lists based on nth integer in list name in R?

Say I have a list of lists with list names that differ by the last integer in the name. gfit10_3 <- list(1,1,1) gfit10_1 <- list(1,1,1) gfit10_2 <- list(1,1,1) gfit10_10 <- list(1,1,1) ...
MAJ's user avatar
  • 467
0 votes
0 answers
28 views

How to export an R list to XLS while maintaining the list structure including nested lists and all names?

Suppose I have a nested list with embedded matrixes that looks like the left-side of the below image. I would like to export that list, maintaining the list structure and all names, with all embedded ...
Village.Idyot's user avatar
-1 votes
0 answers
10 views

"Optimizing Database Queries for High Performance in a Django Application"

Body: "I'm currently working on a Django project and noticing performance bottlenecks related to database queries. The application's responsiveness is crucial, and I'm seeking guidance on ...
Muhammed Jaish's user avatar
-4 votes
0 answers
25 views

What are Pickling and Unpickling? [closed]

technical question related to python I require answer of this question Sure, I can help you with that. Python Pickling Tool Python comes with a built-in package called pickle that can be used to ...
Khushi's user avatar
  • 1
-4 votes
0 answers
26 views

What would you submitted [closed]

What would you like to know or discuss? Whether it's about programming, general knowledge, advice, or anything else, feel free to ask!Description can cover a wide range of topics! It could involve ...
DEV.K's user avatar
  • 1
0 votes
0 answers
7 views

Handling missing keys in list append dictionary

For reading a HTML-tree, I have a script that reads the element-tree. However, the problem I have is that with creating a list, the script uses for a missing value, the last known value. However, ...
user16760825's user avatar
-1 votes
1 answer
43 views

Question about Lists and ArrayLists and more specifically about casting [duplicate]

Why first three lines didn't compile and the remaining 2 did? How exactly does this work? import java.util.*; class HelloWorld { public static void main(String[] args) { //List<Number&...
D P's user avatar
  • 3
-1 votes
1 answer
60 views

How would I clip numbers in a list based on upper and lower limits? [closed]

Here are the instructions: Write a function called clipnums with three parameters – a list of numbers, a upper limit number, and a lower limit number. The function should return a new list where ...
joss's user avatar
  • 3
-4 votes
0 answers
11 views

directory all files into a list? [duplicate]

How can I list all files of a directory in Python and add them to a list? returns everything inside a directory-including both files and directories. I prefer using the glob module ,as it does pattern ...
Nitin Kumar Singh's user avatar
-3 votes
0 answers
31 views

Trouble with Sorting Algorithm in Python [closed]

I'm currently working on a Python program that involves sorting a list of scores for a sports event. I've implemented a sorting algorithm, but I'm encountering unexpected behavior. The maximum score ...
Rohan Kumar's user avatar
-1 votes
1 answer
52 views

same ID to duplicate items in a python list

With the Python programming language, I wrote a program that gives the same ID to duplicate items in a list, but unfortunately I encountered a problem for example, in the example below ,index 5 output ...
donatello's user avatar
0 votes
2 answers
57 views

Declaring foldl ( from left) in terms of foldr (from right)

I have foldl: let rec foldl f lst acc = match lst with | [] -> acc | hd::tl -> foldl f lst (f hd acc) and I have foldr: let rec foldr f lst acc = match lst with | [] -> acc | hd::tl ...
J.B's user avatar
  • 29

1
2 3 4 5
2822