Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

required changes are included #15

Merged
merged 4 commits into from
Sep 7, 2021
Merged

required changes are included #15

merged 4 commits into from
Sep 7, 2021

Conversation

mukeshgurpude
Copy link

@mukeshgurpude mukeshgurpude commented Sep 6, 2021

Since, there's already a draft pull request from this branch, I thought about just pushing changes to this branch only.

  • Edit design.md doc to add dict.pop() to the design

  • Edit Introduction.md to add dict.pop() usage.

  • Edit instructions.md to add new tasks:

    • creation of dict literals (not needed. See comments)
    • using dict.pop()
  • Add appropriate hint as needed in hints.md for dict.pop() usage

  • Edit exemplar.py to include new idiomatic solution for newly added tasks

  • Edit dicts_test.py file to add new tests for dict.pop() task.

  • Edit dicts.py stub file to add new tasks.

  • Edit test file to explicitly list imported functions/methods by name instead of using import *

  • Check/edit all markdown files to conform to the Exercism Markdown Specifications

@mukeshgurpude
Copy link
Author

Edit instructions.md to add new tasks:

  • creation of dict literals
  • using dict.pop()

I didn't got the idea of instructing about creation of dict literals.
Can you please elaborate on this task?

@BethanyG
Copy link
Owner

BethanyG commented Sep 7, 2021

I didn't got the idea of instructing about creation of dict literals.
Can you please elaborate on this task?

This was referring to teaching a student that they can call the constructor (dict()) -- but can also use the literal declaration ({}) when they don't need the overhead of the constructor. -- That the substantial difference is that dict() will unpack, and the literal will not. Screen grab below from the docs on dict().. but we do NOT have to cover all of these by any means.

image

We are teaching comprehensions in a separate exercise.

🤔 Wondering now as I re-read this if we really need a specific exercise task for creating a dict literal vs constructor. I think as long as we have the differences outlined in the introduction.md and the about.md, the student will be able to understand they can use {} OR dict() interchangeably in many/most circumstances.

Worst case scenario is that we will need to do another change farther down the line to the exercise. But that is OK. 😄 These are all works in progress!

Thoughts? For you as a learner, would practicing the difference between {} and dict() be important, or am I making too much of that?

@BethanyG
Copy link
Owner

BethanyG commented Sep 7, 2021

I think we may also want to revise the wording and function name on task number three, to make a distinction between decrementing inventory counts vs removing the item (and all counts) from the inventory (which is your new task #4).

Suggest something like:

3. Decrement stock in the inventory

Implement the decrement_items(<items>) function that takes a list of items. The function should remove one from the available count in the inventory for each time an item appears on the list:

decrement_items({"coal":3, "diamond":1, "iron":5}, ["diamond", "coal", "iron", "iron"])
{"coal":2, "diamond":0, "iron":3}

Item counts in the inventory should not fall below 0. If the number of times an item appears on the list exceeds the count available, the quantity listed for that item should remain at 0 and additional requests for removing counts should be ignored.

delete_items({"coal":2, "wood":1, "diamond":2}, ["coal", "coal", "wood", "wood", "diamond"])
{"coal":0, "wood":0, "diamond":1}


Of course that also means that the exemplar.py, stub, and test file will need to be updated. Apologies for that.

@BethanyG BethanyG self-requested a review September 7, 2021 02:59
Copy link
Owner

@BethanyG BethanyG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mukeshgurpude -- Thank you for all the work on this. 🌟 Apologies for all the delays in reviewing it.

Overall, this looks pretty good! I did have some language suggestions, and an additional thought on task 3 re-wording.

This PR is also failing CI -- I think that's due to some upstream changes from today that you didn't get the chance to pull in. If you can, please do that. If you can't -- we can merge this into my original branch, and resolve the issue there.

@BethanyG BethanyG self-requested a review September 7, 2021 03:13
Copy link
Owner

@BethanyG BethanyG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigh. GitHub got me again. I meant to request changes, but it went ahead and "approved". Again, I think the changes are straightforward and should be quick.

@mukeshgurpude
Copy link
Author

Wondering now as I re-read this if we really need a specific exercise task for creating a dict literal vs constructor. I think as long as we have the differences outlined in the introduction.md and the about.md, the student will be able to understand they can use {} OR dict() interchangeably in many/most circumstances.

That's why I think, there is no need to talk about dict literals and constructor in Instructions, but we have to add that in Introduction section, which is already Done.

I think we may also want to revise the wording and function name on task number three, to make a distinction between decrementing inventory counts vs removing the item (and all counts) from the inventory (which is your new task #4).

I'll do that

@BethanyG
Copy link
Owner

BethanyG commented Sep 7, 2021

That's why I think, there is no need to talk about dict literals and constructor in Instructions, but we have to add that in Introduction section, which is already Done.

Agree. Let's leave that particular change off. 😄 I will go ahead and wait for that last task 3 change, and then we can merge this in! YAY!

Copy link
Owner

@BethanyG BethanyG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 🌟 This looks good to go. Many thanks!

@BethanyG BethanyG merged commit 4069b25 into BethanyG:dicts-typo-patrol Sep 7, 2021
@mukeshgurpude
Copy link
Author

Awesome! 🌟 This looks good to go. Many thanks!

I'm looking forward to contribute more in Exercism!!🥲

@mukeshgurpude mukeshgurpude deleted the dicts-typo-patrol branch September 7, 2021 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants