Homework 4: Inventory Management

Homework 4 turned out to be a little more confusing than anticipated. It was the first time using a data structure rather than just a variable. The requirement of the assignment was to write a python script that would take in an inventory file and manipulate the data based on commands provided through standard in. In the description, the instructor provided some tips on using dictionaries. I could not comprehend how to successfully implement a dictionary for the assignment. I ended up just thinking about the assignment as if I were doing it in c++. Instead of the dictionary, I ended up using a 2D list. I am sure that if a dictionary was implemented, the assignment would have been much easier. As for the manipulation part of the assignment, everything was pretty straight forward. The main problems I had, were that “Quantity” was an int, and it would need its own if statements to account for that. Also, when writing the sort function, I had to learn about key=lambda.

,

One Comment

  • unixuser says:

    I agree this was more of a data structure project. I used a dictionary and a list. So I has a list of dictionaries.
    I found it easier to use a dictionary since the idea was similar to a struct in C++. I had 4 keys like PartsID Description, Footprint, and quantity. I also had the issue where I needed special cases because Footprint
    and Quantity were integers.

Leave a Reply

You must be logged in to post a comment.