76 Discussion / Question Topics

Remove Filter
Member Avatar for
Member Avatar for dhani09

Hello, I have this home work question to be solved on a cloud ide: Create a class called ShoppingCart. Create a constructor that takes no arguments and sets the total attribute to zero, and initializes an empty dict attribute named items. Create a method add_item that requires item_name, quantity and …

Member Avatar for Emma Etigu
0
1K
Member Avatar for gishi

hi! i want to place the contents of a dictionary into a csv file. Can someone help me with this? i already have the code in reading the csv file [CODE] import csv reader = csv.reader(open("c:\sample.dat")) for row in reader: print row [/CODE] i want the first element of the …

Member Avatar for Gribouillis
0
15K
Member Avatar for Saran_1

Here is the CSV file that I am working with: `"A","B","C","D","E","F","G","H","I","J" "88",18,1,"<Req TID=""34"" ReqType=""MS""><IISO /><CID>2</CID><MemID>0000</MemID><MemPass /><RequestData><S>[REMOVED]</S><Na /><La /><Card>[REMOVED]</Card><Address /><HPhone /><Mail /></ReqData></Req>","<Response T=""3"" RequestType=""MS""><MS><Memb><PrivateMembers /><Ob>0-12-af</Ob><Locator /></Memb><S>[REMOVED]</S><CNum>[REMOVED]</CNum><FName /><LaName /><Address /><HPhone /><Email /><IISO /><MemID /><MemPass /><T /><CID /><T /></MS></Response>",0-JAN-10 12.00.02 AM,27-JUN-15 12.00.00 AM,"26",667,0 "22",22,1,"<Req TID=""45"" ReqType=""MS""><IISO /><CID>4</CID><MemID>0000</MemID><MemPass /><RequestData><S>[REMOVED]</S><Na /><La /><Card>[REMOVED]</Card><Address /><HPhone /><Mail /></ReqData></Req>","<Response …

0
186
Member Avatar for ogsirus

Hi guys, I am trying to write a program which picks the closest number possible out of a dictionary. The dictionary contains 50 doubles values, and I use a random double to pick the number i want to get the closest to if that makes sense. Currently I am using …

Member Avatar for ogsirus
0
854
Member Avatar for psvmr

I have been trying to create a program which the teacher log in to view the scores of a test of a school class. The scores are stored in a text file like this: Charlotte:7 Charlotte:4 Charlotte:3 Chelsea:2 Chelsea:9 Chelsea:5 Jeff:1 Jeff:10 As you can see there are multiple scores …

Member Avatar for vegaseat
0
670
Member Avatar for ogsirus

Hi Guys, Im a bit puzzled on the best way to store data which will later be saved to a csv. I am doing a record search on a database table which will get cycle through each employee and get the relevent information. Once I have done this I will …

Member Avatar for deceptikon
0
301
Member Avatar for Sunil_12

Hello All, I am working on writing a code to implement dictionary in C++. I have few functions to implement for my dictionary. Can someone please help me writing the definitions for my dictionary. Header file and cpp file is attached here. **Dict.h file is as below:** enum WordType{All, Animal, …

Member Avatar for Sunil_12
0
262
Member Avatar for kamilacbe

hi, I need to copy a dictionary to another dictionary where the Dictionary contains class data as value for eg I want to copy the data of object A1 to A2 .Thanks for your time. Class A { } Class B { } Main() { Dictionary<int,A> A1 = new Dictionary<int,A>(); …

Member Avatar for cgeier
0
249
Member Avatar for kxjakkk

file_spellcheck = input("Name of the document to be spell-checked: ") with open(file_spellcheck, "r") as i: spellchecking = i.read() for item in spellchecking: items = item.split() if items in with open("file.out", "w") as i: i.write() I need to make a spell checker that uses another file as a dictionary. So let's …

Member Avatar for vegaseat
0
272
Member Avatar for kxjakkk

I'm trying to create a program that will prompt the user for a list of text files to read from, then read those text files and build a dictionary of all the unique words found. Then finally put those unique words into another file and make it alphabetical order from …

Member Avatar for kxjakkk
0
637
Member Avatar for knan

I have a dictionary [CODE]dict1={'18':['4000','1234'],'12':['7000','4821','187','1860','123','9000']}[/CODE] I want to sort the keys and values such that, the output is, [CODE]dict1={'12':['123','187','1860','4821','7000','9000'],'18':['1234','4000']}[/CODE] I tried something! but it didn work [CODE]>>> for values in dict1: ... dict1[values].sort() ... >>> dict1 {'18': ['1234', '4000'], '12': ['123', '1860', '187', '4821', '7000', '9000']}[/CODE] Full sorting happens for …

Member Avatar for grantjenks
0
806
Member Avatar for 2014learner

I currently have five resx files in a XAML and C# application. I would like to convert the .resx files into their own resource dictionary. How do I do that by what code or website to look at? In the App.Xaml, xaml, and C# what is the process?

Member Avatar for ddanbe
0
145
Member Avatar for flebber

What I am trying to do is delete the key value pairs out of a dictionary if the value is = 0. I seem not to be acheiving that so far. Python 2.7.5+ (default, Sep 19 2013, 13:48:49) [GCC 4.8.1] on linux2 Type "help", "copyright", "credits" or "license" for more …

Member Avatar for flebber
0
416
Member Avatar for empuk2

Hello everybody...I'm new in C# programming but recently I have a problem and need to solve it. I hope you guys can help me. This problem only can solved with List and Dictionary. [CODE] using System; using System.Collections.Generic; using System.Text; using System.Collections; namespace ApplicantTestin { /// The DataObject class stored …

Member Avatar for walshregal
0
631
Member Avatar for nikki05

Hi, I would like to to to store the Name and Items of ComboBox into dictionary. With the below code,I am able to store them. However, Name of ComboBox is as counting ComboBox10 to ComboBox1n. I would like to store Name of ComboBox as ComboBox1,ComboBox2 rather than ComboBox10 to ComboBox1n …

Member Avatar for nikki05
0
552
Member Avatar for nikki05

Hi I am storing name and texts of controls (Label, Button, ComboBox, ListBox, etc.) into a dictionary. With ContainsKey, I am able to find the texts of Labels, Buttons, and RadioButtons. However, I am getting problem to find the items of ComboBox. Appreciate if you have an idea. If _dic.ContainsKey(selectedControl.Name) …

Member Avatar for nikki05
0
224
Member Avatar for nikki05

Hi , I am able to add Label, button,texboxes into Dictionary. However I am getting problem to add values of Combobox into dictionary. Here is how I was trying to do. Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Try Dim myLabel As Label Dim myButton As Button …

Member Avatar for Reverend Jim
0
324
Member Avatar for Pallab.Bhk

Hey I have dictionary like following one dicts = {'met_293': ['81.0175','4','7','7','29.76','23','1','0','22','28.57','2','[KG]EHY'],'met_394': ['79.9579','4','7','7','29.76','18','3','0','15','28.57','2','EHY[ILV]'],'met_309': ['81.0175','4','7','7','29.76','23','1','0','22','28.57','2','[KG]EHY'],'met_387': ['79.9579','4','7','7','29.76','18','3','0','15','28.57','2','EHY[ILV]']} I want to remove keys which have same value like 'met_293' and 'met_309' those two keys have same value at 12th position which is '[KG]EHY' so i want my dictionary like this {'met_293': ['81.0175','4','7','7','29.76','23','1','0','22','28.57','2','[KG]EHY'],'met_394': ['79.9579','4','7','7','29.76','18','3','0','15','28.57','2','EHY[ILV]']} any …

Member Avatar for Pallab.Bhk
0
484
Member Avatar for lizaron

I have a data set like this data=[{u'a': u'D', u'b': 100.0, u'c': 201L, u'd': datetime.datetime(2007, 12, 29, 0, 0), u'e': datetime.datetime(2008, 1, 1, 6, 27, 41)},{u'a': u'W', u'b': 100.0, u'c': 201L, u'd': datetime.datetime(2007, 12, 29, 0, 0), u'e': datetime.datetime(2008, 2, 4, 6, 27, 41)},{u'a': u'W', u'b': 100.0, u'c': 202L, u'd': …

Member Avatar for zjtpjs4
0
270
Member Avatar for dirtydit27

Hello, I'm currently working on a homework problem that requires me to create a dictionary from a .txt file that contains some of the worst cars ever made. The file looks something like this: 1958 MGA Twin Cam 1958 Zunndapp Janus 1961 Amphicar 1961 Corvair 1966 Peel Trident 1970 AMC …

Member Avatar for snippsat
0
368
Member Avatar for yunniesshi

Please help me with this I really need your help. Thank you so much. #define EMPTY __________ #define DELETED __________ #define max 1100 #define setSize 20 typedef struct { unsigned long ID; char Lname[16],Fname[24],MI; char course[8],year; }Student; typedef struct { Student Stud; int link /*used to link to next synonyms*/ …

Member Avatar for deceptikon
0
242
Member Avatar for yunniesshi

Hi please help me with this. My head really hurts from attempting to answer this question. Thanks a lot! #define maxCells 1000 #define maxCS 11 #define maxIT 19 typedef struct { char LN[16], FN[24], MI; }nametype; typedef struct studtype { unsigned long ID; nametype name; char course[8]; int yr; }student; …

Member Avatar for deceptikon
0
518
Member Avatar for findlay

Hello, Is there any way to access a large number of keys in a dictionary efficiently. Perhaps via indexing with an array of lookup values. Some pseudo code may help; dictionary={a:1, b:2, c:3 ...etc} lookup=[a, a, b, c, c ... etc] print dictionary[lookup] thanks, Joe

Member Avatar for woooee
0
262
Member Avatar for MonsieurPointer

Hi DaniWebbers, I would like to map a string to a Property using the Dictionary class. For example, I want to map "port" to a textbox's Text property, e.g. myDict.Add(tbPort.Text, "port"). How would I go about defining the dictionary? I've tried the following: * Private myDict As Dictionary(Of Property, String) …

Member Avatar for Reverend Jim
0
255
Member Avatar for greatman05

This is homework. I am trying to implement a Dictionary ADT using a hash-table with a closed addressing scheme. The problem is that I'm required to make a hash table of Word classes. How can I do this? The class has to be templated. Here is what I have so …

0
167
Member Avatar for TheWolverine

Hi all, I've browsed the net trying to find a paradigm to describe what I'm looking for but haven't been successful. So I'll try to explain it as succinctly as I can. Right now, for my PhD research, I've set out a few applications that take input files that have …

Member Avatar for TheWolverine
0
236
Member Avatar for heinlein_

Hi, I have a little problem. I want to replace words in a text, but only 'whole words'. That is, I'm looking for a method that changes "cat", but not "catfood". I know how to do it using re.sub, like this: re.sub(r'\bword\b', 'change', text) Only problem is, I'm using a …

Member Avatar for heinlein_
0
7K
Member Avatar for abc_defgh

Hi, I have dictionary Dictionary<string, string>. I need to serialize it so that during switching diferent forms. How can I do that. If any one can provide a sample code example would have been great help. Regards,

Member Avatar for thines01
0
82
Member Avatar for greatman05

Hello. What are some ways that one can work with (x,y) coordinate pairs in Python? I'm doing a homework assignment that requires me to create a program that can check for certain binary relations (reflexive, transitive, symmetric), and I'm having an issue coming up with the best approach for it. …

Member Avatar for greatman05
0
275
Member Avatar for .:n'tQ-boy:.

Hi mate, I am doing a mini program in java that let us look up word as a dictionary. I tended to use database to store words and their meanings, but my teacher suggested me using file (or xml). I chose using file (write a vector to file). Can u …

Member Avatar for joehms22
0
192

The End.