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.
132,687
questions
1
vote
4
answers
39
views
Append lists of a dictionary
I have a dictionary with values are lists.
n = {'d1': [1, 2, 3], 'd2': ['a', 'b', 'c']}
m = {'d1': [4, 5], 'd2': ['d', 'e']}
I am trying to have as an output.
{'d1': [1, 2, 3, 4, 5], 'd2': ['a', 'b', ...
-1
votes
0
answers
11
views
Rabdom list in a pwa
I have to implement a program that must show a random list of actions to put in a right order to make coffee.
Should i start a spring project with mysql? Do I need to create a table with the actions?
0
votes
0
answers
20
views
combine values from a list of a dictionaries [duplicate]
I'm trying to combine a list that contains dictionaries with matching values.
list = [
{"country": "united states", "state": "texas", "city": &...
0
votes
1
answer
28
views
Printing two lists by taking turns and using time.sleep in Python
I have two lists: [1,2,3,4,5] and ['a','b','c','d','e','f']. (Note that one has 5 items, the other 6).
What I want is to print them, item-by-item, taking turns, with a one-second delay, each list on ...
0
votes
3
answers
51
views
How to re-order and expand lists to have same size?
I am trying to re-order and extend lists of dictionary values with the right position and fill them with zeros.
myDict = {
"col-1": ['a', 'b', 'c', 'd', 'e', 'f', 'g'],
"col-2&...
0
votes
0
answers
15
views
Sorting in a list with tuples with second element in a tuple [duplicate]
I have a code:
scores_list_ind = list(enumerate(scores_list, 1))
and I have output:
[(1, 3), (2, 5), (3, 7), (4, 4), (5, 8), (6, 7)]
I tried to use sorted() and it sorted me to this:
[(6, 7), (5, 8),...
-1
votes
0
answers
26
views
Python generate sets of pairings between two lists [duplicate]
Given two lists in Python
a = [1, 2, 3]
b = [4, 5, 6]
We can use c=list(itertools.product(a,b)) to generate all possible permutations, this will output
[(1, 4), (1, 5), (1, 6), (2, 4), (2, 5), (2, 6),...
1
vote
1
answer
31
views
Generate a random amount of numbers and sort them with bubble sort
I am new to programming and I am trying to generate an amount of numbers b and then sorting it with bubble sort without using the sort function of list (Because that would be too easy). Since arrays ...
-1
votes
2
answers
23
views
Python - Sequentially group strings in a list starting with the same substring
I have a list of strings that looks like this:
my_list = ["A-Item one", "B-Item two", "A-Item three", "A-Item four", "B-Item five", "B-Item six&...
0
votes
3
answers
38
views
a function that takes a list of integers and prints a string of stars which has the length of a value of an integer to the screen
first of all, hello to everyone! I'm a first timer in here!
anyways, I had this problem and I dont have a real direction...
I tried this:
def MyStars(inputList):
l = len(inputList)
ret = []
for x in ...
4
votes
3
answers
73
views
Strange slicing behavior in Python
I found this to be a bit strange. Can anyone explain to me: Why, if I have a list like this:
l = [1, 2, 3, 4, 5]
and I do this reassignment:
l[-1:0] = [99,]
then it inserts the 99 to the left of the ...
-1
votes
1
answer
30
views
Add key and list value to a dictionary
I have this basic list dictionary {'2011': ['William', 'George', 'Nancy'], '2012': ['Joe', 'Math']} that I want to add a key and list but it doesn't work
here my code:
my_dict = {"2011": [&...
0
votes
0
answers
28
views
How to call multiple distribution functions from different vectors into a function in R
Lets talk you through my workflow:
General idea
Based on data in a dataframe, select the appropriate distribution functions, combine them in all possible ways to get the mean of the combined ...
-1
votes
0
answers
19
views
"Maximum value in an array of Increasing and Decreasing" some test cases failed in hackerrank & array lists only to be used no simple array
Was practicing some questions on hackerrank so I encountered this program not all test cases passed, please guide where is the mistake. Thanks
The relevant code block is shown below pls guide where I ...
0
votes
0
answers
25
views
Choose best prediction
I have ML model, I have six images to make predictions, accuracy is 95% for top 3 results and 77% for top 1 result, actually predictions are in top 3 results match
Have a look at example
res_objs, ...