Python Forum
Dictionary based assignment: Need help
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dictionary based assignment: Need help
#7
List of parts and quantity can be obtained quite easily. I don't know whether is in correct format or not:

def parts_list(bike_id):
    for row in products:
        if row['BikeID'] == bike_id:
            return row['BikeParts']
Which will produce:

>>> parts_list('bike301')
['WH339:2', 'TR302:2', 'TU377:2', 'FR301:1', 'FB301:1', 'BB301:1', 'GS301:1']
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
Dictionary based assignment: Need help - by RoyceJ - Aug-21-2018, 02:28 AM
UPDATE: Dictionary based assignment - by RoyceJ - Aug-27-2018, 02:24 AM
RE: Dictionary based assignment: Need help - by perfringo - Aug-29-2018, 05:30 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Dictionary based exercise garvind25 2 2,028 Jul-12-2020, 06:53 PM
Last Post: garvind25
  Powerball assignment, how to get correct output of a dictionary ? msp1981 5 3,393 Mar-19-2019, 11:02 PM
Last Post: Yoriz
  logic comparater based on dictionary values ijosefson 3 3,319 Oct-16-2017, 06:04 AM
Last Post: Mekire

Forum Jump:

User Panel Messages

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