How to multiply dictionary values with other values based on the dictionary's key?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Aug 19 20:33:00 EDT 2018
On Sun, 19 Aug 2018 05:29:46 -0700, giannis.dafnomilis wrote:
> With your help I have arrived at this point: I have the dictionary
> varsdict (size 5) as below
>
> Key Type Size Value
> FEq_(0,_0,_0,_0) float 1 1.0
> FEq_(0,_0,_1,_1) float 1 1.0
> FEq_(0,_0,_2,_2) float 1 1.0
> FEq_(0,_0,_3,_0) float 1 1.0
> FEq_(0,_0,_4,_1) float 1 1.0
That's not a Python dict. It looks like some sort of table structure. How
do you get this? (What menu command do you run, what buttons to you
click, etc?) I'm guessing you are using an IDE ("Integrated Development
Environment") like Anaconda or similar. Is that right?
Python dicts print something like this:
{'FEq_(0,_0,_4,_1)': 9999, 'FEq_(0,_0,_3,_0)': 9999}
If you run
print(varsdict)
what does it show?
(I have limited time to respond at the moment, so apologies for the brief
answers. Hopefully someone else will step in with some help too.)
--
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson
More information about the Python-list
mailing list