I submitted code that passed all the existing tests but failed to correctly handle some actual resistor values in use in the E48 (2% tolerance) and larger series. There are currently no tests for 5-band resistors where the second band is black, which my earlier iteration handled wrongly.
Hi @xanni
Welcome to the Exercism forums!
Thanks for reporting this, and for starting a discussion here. I noticed your github issue last night and reopened it.
I’d welcome a test case or two, if you’d like to propose them and create a PR. This isn’t an exercise that pulls from problem-specifications
, so it would be a matter of reviewing the test file on the Python track, and matching the style there to add new test cases.
You would then need to test the corresponding example.py file to make sure it passed the new cases (and change it if it does not pass the new cases).
Otherwise, I can add this to my list of things to do. It might take a little while, but i can address it.
Let me know either way.
I have added new tests, checked them against the example.py and created a PR: Update resistor_color_expert_test.py by xanni · Pull Request #3797 · exercism/python · GitHub
Approved and merged! Thank you!
LMK if you want it marked “Hacktoberfest accepted”.
Sure why not! Thanks.
Would it be fun to also add the requirement to handle three-band resistors which are 20% tolerance (the case where there is no tolerance band)?
Maybe.
The things we’d have to weight are:
- Does this add to the core programming concepts for the exercise?
- Would adding this requirement invalidate the existing 2,359 solutions that have already been submitted?
And would point one be enough to override point 2?
Thoughts?
- Not really, it’s just an exception case that’s good to handle.
- Yes, since it’s a new requirement that wasn’t originally part of the exercise… and that’s probably a good enough reason to leave it out.
So my thought process would be that we leave this exercise alone.
BUT.
If this is a topic you have expertise in/enthusiasm for, I would be fine if you wanted to create another Python-track (non problem spec) practice exercise in the series. It would need to cover some programming technique or problem solving that was, different, additional, or a twist on what we already do for the other Resistor
exercises we have in place.
You mention exception handling, so that could be a part of it, although the exercise would probably need to be more than exception handling. The first three in the series were all about translating strings to values and using things like lists
and other container data structures. The expert one introduced more str
processing and handling, as well as the potential for indexing and slicing and the like.
Dunno if we could do something around when to use and not use certain resistors in places in a circuit, or … ?? It does need to be simple enough that someone who is not familiar can read the directions and plan out code.
Up to you weather you think it would be fun to work on or not. Docs for creating practice exercises are here.
Just LMK if you’d like to take something like that on.
I’m not sure it’s worth an extra exercise… perhaps to go all the way and also handle gold and silver multiplier bands (negative powers of ten)?
I’m just the sort of person who can’t help thinking about edge cases and missing aspects of “real world” examples.