[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/diy/ - Do It Yourself


View post   

File: 28 KB, 721x571, IMG_20200627_133531.jpg [View same] [iqdb] [saucenao] [google]
1857282 No.1857282 [Reply] [Original]

>python

What's the logic of making dictionary that has 2 or more of the same item?
Like a shop having the same 500 of the same items in stock.

>> No.1857283

I lay awake at night pondering this exact question. Somebody please explain this insane behavior so I can sleep again.

>> No.1857310

For synonyms?
Maybe bad programmers?

>> No.1857323

>>1857282
>>python

>> No.1857328

>>1857282
you can make a list of dictionaries, so you can references things like:
>list[4]["ID"]


but that's kinda retarded and is the reason classes exist

>> No.1857796

Never fucking mind.

I just had to add a counter on an item.

>> No.1857800

>>1857282
Why was he banned

>> No.1857977

>>1857800
>>>/g/

>> No.1857991

>>1857977
I dont think /g/ would know

>> No.1858052

>>1857282
you could just make a class Item that contains info such as name, description price and stock then keep a list of items instead of a dictionary.

>> No.1858120

>>1857282
>>1858052
or you could make a list of tuples where one variable in the tuple is the amount in stock.

why do you want this to be a dictionary? what would this dictionary look like?

>> No.1858138

>>1857800
Demanded too much money after the only other platform shut down

>> No.1858336

python is for poojeets