Skip to main content

All Questions

Tagged with
1 vote
3 answers
74 views

How to iterate through a dictionary to get values on the lowest level?

Please help me understand how to extract the value of each ingredient for each product and do something with it. But for starters I just want to print them all one by one. MENU = { "product_1&...
Genkuru's user avatar
  • 21
0 votes
2 answers
56 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
-1 votes
1 answer
117 views

Explain Javascript array iteration methods?

To perform a performance test for JavaScript's built-in higher-order functions for map, filter, find, you can use the performance.now() method to measure the time it takes to execute each operation. ...
Apurv's user avatar
  • 105
0 votes
2 answers
187 views

Function for converting columns of a data frame into key value pairs

I have a dataframe (these are just sample columns for reference, the actual number of columns is quite large) id A B C D 123 24 98 74 32 456 65 90 61 96 I would like to convert it into a data ...
Anusha Pal's user avatar
0 votes
3 answers
202 views

What is the most efficient way to increment all values of a dictionary in c#?

I have hundreds of dictionaries where all the values of all the dictionaries need to be incremented by 1. What is the most performant way to do that in C#? I thought of iterating through the keys ...
osman doluca's user avatar
0 votes
1 answer
58 views

Python overwriting dictionaries while iterating

I'm currently trying to write data to a json file. It's a dictionary with a nested dictionary inside. I'm iterating through jsonArray which is a list of dictionaries. Each dictionary has information ...
Nathan's user avatar
  • 13
1 vote
1 answer
46 views

How can I put the elements in the list next to the print out of the dictionary values?

DESIRED OUTPUT: Proportion of 1- letter words: 4.76% (1231 words) Proportion of 2- letter words: 16.14% (4177 words) Proportion of 3- letter words: 20.33% (5261 words) Proportion of 4- letter words: ...
Jordan Faulkner's user avatar
0 votes
3 answers
80 views

Printing to table form from a list and a nested list

psetHere is my code so far: MEDALS = 3 COUNTRIES = 8 # Create a list of country names. countries = [ "Canada", "Italy", "Germany", "Japan", "...
Jordan Faulkner's user avatar
0 votes
2 answers
199 views

Get the count of most occurring element in a list at every iteration

I need to fetch the most occurring ID in a list at every iteration I process the list. Its a huge list that contains positive/negative IDs. If ID is positive, increase the count for that ID; if ...
Neha Hattiholi's user avatar
-2 votes
1 answer
225 views

How to extract values from a python dictionary and use it in a function?

help is much appreciated! In python, I want to access the values only of specific keys in a dictionary and use them in a function. This is an example of the dictionary that I have: dict={'key1': ['a', ...
Kyle's user avatar
  • 11
-2 votes
2 answers
85 views

How to get the total duration of a project

I was given a list of dictionaries with different keys and values, one of them is the duration of an activity and each activity has predecessors, I need to calculate the total duration of the project ...
Ericka Salinas's user avatar
0 votes
2 answers
63 views

How to loop through dict of list of dict kind of data using python

i am trying to loop through using python {u'customfield_10067': [u'{"field_type":"cmdb-object-cftype","value":{"workspaceId":"dsjahdjasf-61f7-4421-9ced-...
abhinav's user avatar
0 votes
4 answers
153 views

Reversing dictionary key to value and vice-versa python

a_dict = {'one': 1, 'two': 2, 'thee': 3, 'four': 4} new_dict = {} for key, value in a_dict.items(): new_dict[value] = key print(new_dict) #result will be as below {1: 'one', 2: 'two', 3: 'thee', ...
Amanuel Yohannes's user avatar
0 votes
1 answer
39 views

updating dictionaries in python from list of booleans

I have an empty dictionary I want to add to. My solution works but I want to keep adding for each iteration in a dataset. The outcome is only showing one key:value pair. Is there a way to do this? My ...
n3wb's user avatar
  • 7
0 votes
1 answer
49 views

How to iterate through a nested dictionary?

def topping_type_and_num(amount_of_toppings, count, toppings_dict): toppings_chosen = {} for a in range (int(amount_of_toppings)): list_of_toppings() topping_chosen = input(&...
Calen's user avatar
  • 1

15 30 50 per page
1
2 3 4 5
34