Skip to main content

All Questions

Tagged with
-1 votes
1 answer
60 views

Representing the maze in the Dictionary in Python

I am a new computer science student, and now we know the Python language. It is beautiful, but I have many problems with it. Sorry, I can solve this question. enter image description here I tried to ...
مصطفى حسين خزعل بهلول's user avatar
1 vote
2 answers
40 views

Expanding the Dictionary item from datafame column

I have pandas dataframe with a column I have a dataframe with a column having the value like below df['dbpedia_entry'] {'dbpedia_entity': ['c'],'dbpedia_id': ['f'],'dbpedia_label': ['k'],'...
Rahul's user avatar
  • 11
1 vote
1 answer
41 views

Why is my code not displaying firstNotRepeatingCharacter in the string, in Python?

So, I am solving this code signal problem and it's problem statement is as follows Given a string s consisting of small English letters, find and return the first instance of a non-repeating ...
vilnius19's user avatar
  • 115
1 vote
0 answers
65 views

What is the meaning of nums[complement] in the following line of code return [nums_dict[complement],i] in Python?

So, I am solving a problem of Two sum which has a following problem statement : **Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to ...
PurpleRabbit's user avatar
0 votes
1 answer
41 views

map list based on dict internal values

I have a list like: [{'sample': {'sample_context': {'board': u'9', 'encoder': u'1'}, 18421: u'1191'}}, {'sample': {'sample_context': {'board': u'5', 'encoder': u'1'}, 18422: u'2251'}}, {'sample': {'...
Kumar Roshan Mehta's user avatar
-2 votes
1 answer
43 views

How do I find the how much is the value of a key in python, when the dictionary is in another file?

I am making this coffee machine and my dictionary is in another file. How do I find how much more resource is needed to make a particular type of coffee? if main.resources.keys('ingredients') >= ...
Medhansh Mathur's user avatar
-2 votes
2 answers
95 views

How to decrypt or convert Python Dictionary of lists to normal dictionary

Very new to python and literally struggling to get this fixed. I have dictionary like below from json file. I believe this is being called as Dictionary of lists. MyDict = [{Key:[1,2,3,4]}, {Summary:[...
Data Analyst's user avatar
1 vote
2 answers
49 views

Get the list of names which satisfy the condition in dictionary from given list

I have a dictionary in which there are three conditions startwith, contains and endwith given below, dict1 = {'startwith':"Raja, Bina", 'contains':"Tata", "endwith":"...
Mohit's user avatar
  • 137
-4 votes
2 answers
167 views

what is "count[character] = count[character] + 1" doing in this program to count letters in a sentence

The line of code below is meant to count the number of individual letters in the sentence assigned to the variable "message". message = 'It was a bright cold day in April, and the clocks ...
Gudmann1's user avatar
0 votes
1 answer
33 views

Python Version Creates Different Dictionaries [duplicate]

I have a script which needs to be compatible with both Python 2 and 3. The code utilizes a dictionary with is generated using the following line of code: x = {2**x-1: 1-1/8*x if x>0 else -1 for x ...
Alex's user avatar
  • 55
0 votes
1 answer
169 views

Convert one column csv into Dictionary with same key:value pair in python 2.7 (using import csv)

I have one CSV file as sample.csv which contains ABC XYZ LMN ... And from this file, I have to make a dictionary like below Dict = {'ABC':'ABC','XYZ':'XYZ','LMN':'LMN',...} using import csv
a_a's user avatar
  • 1
0 votes
1 answer
52 views

Parsing data from file of 3 columns to store data in dictionary with structure dict[key1][key2]

I am trying to solve the task: Read data from the "Region", "Range" and "Population" columns. Region Range Population Region1 23 1299 Region1 34 ...
andsemenov's user avatar
0 votes
1 answer
62 views

How to sort python dict based on multiple dict keys?

For the following data, I am looking to sort the data first by the "date" property, and then by the "name" property. Input: results = { "a":{ "date":&...
fiona_neu's user avatar
1 vote
2 answers
100 views

Insert values of list of lists in a dictionary declared with keys

I have this list of lists: x = [['x1', 'x2', 'x3', 'x4', 'x5', 'x6', 'x7', 'x8', 'x9', 'x10', 'x11'], ['x1', 'x2', 'x3', 'x4', 'x5', 'x6', 'x7', 'x8', 'x9', 'x10', 'x11'], ['x1', 'x2', 'x3', ...
Jordi Lazo's user avatar
0 votes
5 answers
87 views

How can I create a pro-rated salary scale dictionary using a for loop?

somewhat new to Python here and wondering what the best way to accomplish this task would be. I am trying to create a dictionary that represents a pro-rated salary scale for a certain amount of days. ...
rand_user_999's user avatar

15 30 50 per page
1
2 3 4 5
153