Skip to main content

All Questions

Tagged with
0 votes
2 answers
57 views

Iterate through a list in chunks [duplicate]

I need to call an API interatively, but the api endpoint limits me to 100 calls per minute. I have a list which is used as the data for an API call (I'm using requests to call the API). Lets say the ...
Alan Mott's user avatar
0 votes
1 answer
61 views

how to efficiently check common elements of two lists of different types ( class A and class B) and make a resultant list of type A for all matches

I have a list of class A with 1000 elements that has all unique ids. There is some other Class B , which also has a unique id parameter and this B is a json property of Class A. the relation is like : ...
raga_717's user avatar
-1 votes
1 answer
60 views

Iterating through dict and list2d, list_value gets replaced with a str

I am iterating through a dict and after that through a 2d list[list[float|int] then i am changing the values of the list2d to the corresponding in the dict randomly a str appears from the test i did ...
Navid Yaghmaei's user avatar
0 votes
2 answers
56 views

Compare elements and their position in two python lists

I have two lists: list_1 and list_2. list_1 contains integers, list_2 contains integers + chars (I added it in list_2 by concatenating int, str using the str() func). list_1 = ['101', '102', and so on....
Arbaaz Hussain's user avatar
0 votes
0 answers
78 views

How to iterate across columns to find intersection in R? [duplicate]

I have a data.frame in R which has more or less this structure: structure(list(F1 = c(1, 2, 3, NA, NA), F2 = c(NA, 2, 3, 4, NA ), F3 = c(NA, NA, NA, 4, 5)), class = "data.frame", row.names = ...
Alejandro Carrera's user avatar
0 votes
0 answers
28 views

How to execute code for each element in a list? [duplicate]

I have what had ended up being a long block of code to do some calculations where I currently set the year in which I am interested manually. I am looking to do this instead using a list. Ideally, I ...
JamesW's user avatar
  • 155
1 vote
1 answer
72 views

Netlogo: efficient iteration using 'foreach'

I want to calculate and store two certain quantities associated with turtles' properties, namely count how many turtles meet a condition and the sum of these turtles' specific attribute. That specific ...
G. Papad.'s user avatar
0 votes
0 answers
22 views

Is there a reason that Python allows indexing the class list itself? [duplicate]

I have come across a "feature" of Python that allows one to index the list class (and all classes that implement __getitem__() AFAIK). It took me a non-trivial amount of time to uncover that ...
Epanemu's user avatar
  • 130
-1 votes
2 answers
88 views

Going back to an earlier index in list iteration

I have this loop over a list: MyList = ["test", "test2", "test3", "test4", "test5", "test6", "test7"] for item in MyList: ...
EliaOndacs's user avatar
-2 votes
2 answers
304 views

Python: best way to iterate through lists and store which has max value for each index

In Python (3.8), I have 15 lists of the same length. Each list contains floats. Here for the example, I will pretend I have 3 lists of length 5 to demonstrate my problem: List1 = [29.561801, 29.564141,...
Tritize's user avatar
  • 39
0 votes
2 answers
63 views

Python - Iterating through nested dictionaries to populate a list based on values - Encounter 'str' object has no attribute 'items'

I'm creating a code that should allow a user to select multiple objects from a list. Each user has an allotted amount of space, and each object has a specified size. I'm trying to populate the list ...
Moonlyte Demon's user avatar
0 votes
1 answer
44 views

Tkinter: Listbox not populating from function call, populates from list

I have a function that creates a list, and another that's supposed to populate a tkinter listbox with the items from that list. When a radio button is clicked the contents of the listbox should update....
Sabresong's user avatar
0 votes
0 answers
23 views

How can I use a for loop to strip parens from list elements and print them one at a time? [duplicate]

I have a list from an n_choose_k operation. The list is composed of number combinations that are each surrounded by parentheses. import itertools number = 9 k = 3 n = range(1,number) combos = list(...
cat_herder's user avatar
-1 votes
2 answers
73 views

How to remove elements from list while iterating [duplicate]

hey I have a issue where i want to remove some elements from a list, the problem is it change the index and them don't know how to remove the index that actually need next so it remove "salt"...
Sheep's user avatar
  • 1
0 votes
1 answer
64 views

Read nested list with other attributes in Java streams

I have a list of object for example Person in turn have couple of lists with few generic attributes like below List<Address> address1 = List.of("1","2","5","6&...
rev gan's user avatar
  • 87

15 30 50 per page
1
2 3 4 5
67