lesson 23 practice " Using right items" task is a unclear and may be teaching bad habits or hardcoding values #982
Labels
content
Issues with the lessons, practices, including their code examples
I have a programming background so my immediate thought was that loops and conditional checking was what the problem was looking for, especially since the lesson module discusses use of the size() method. Something to the effect of
I wrote this solution assuming the inventory array contained strings, as shown in the associated lesson module, and was surprised to find this was not the case; string matching failed, inventory wasn't really accessible, print functions (e.g., print(inventory.size()) didn't work like in the lesson) and my solution was just super broken. I then realized this was maybe over-engineered and tried the much simpler answer of human visual inspection of the inventory array image on the right and gave a hard-coded answer of use_item(inventory[x]) use_item(inventory[y]) and it worked. This feels wrong from a teaching perspective.
As a long time programmer and teacher, this lesson/practice really bothered me because it teaches a bad habit of hardcoding magic values specific to the example and doesn't teach anything about the dynamic nature of data which is a core concept. I feel like a much better lesson would include more boilerplate code to scan the inventory array, as described above in the pseudocode, and have the student flesh it out the rest of the way to make it functional in a more general purpose way (and teach better habits that more closely reflect real-world use cases). Maybe even just provide the full answer for finding the first sword and leave the student to copy it for finding the shield. Also maybe consider renaming the function pick_sword_and_shield() to be specific to the above pseudocode if making these changes.
The text was updated successfully, but these errors were encountered: