Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Dictionary Comprehension - ValueError: too many values to unpack (expected 2)
Post: RE: Dictionary Comprehension - ValueError: too man...

(Dec-22-2017, 08:59 AM)squenson Wrote: kilo is a value, so dGroD[kilo] doesn't make much sense. Try: dGroD = {veg:kilo*2 for (veg,kilo) in dGro if kilo > 1}This works as well: dGroD = {veg: kilo ...
samRddhi General Coding Help 2 8,494 Dec-22-2017, 09:25 AM
    Thread: Dictionary Comprehension - ValueError: too many values to unpack (expected 2)
Post: Dictionary Comprehension - ValueError: too many va...

Hi, Trying to understand dictionary comprehension. dGro = {"Cabbage": 2, "Carrot":3, "Peas":5, "LadyFinger":1} print (dGro) dGroD = {veg:kilo*2 for (veg,kilo) in dGro.items()} print(dGroD)The above ...
samRddhi General Coding Help 2 8,494 Dec-22-2017, 08:45 AM
    Thread: why is this variable not printing out properly?
Post: RE: why is this variable not printing out properly...

Use print('The result of all calculations is ' + str(var1) + ' and we are done.')
samRddhi General Coding Help 11 8,031 Dec-22-2017, 08:38 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020