-
-
Notifications
You must be signed in to change notification settings - Fork 947
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
Create mentoring.md for Say #2211
Conversation
|
||
There are a wide variety of valid approaches to this problem, which gives students a lot of opportunity to experiment and encounter new ways of manipulating data. | ||
Some useful techniques that students might not have encountered are listed below. | ||
Students will not need or want to use all of these, but mentors should look for opportunities in the student's code to introduce one or more of them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this list of functions is super helpful when mentoring an exercise. As a mentor, I'd want to see discussions on approaches and solutions at a higher level, not specific string methods which may or may not be useful here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do see your point about the specificity of some lines - 97, 99-101 are probably unnecessary. But since there's a lot going on in this exercise, I figured having a list of suggested techniques would be helpful as a quick reference - if a mentor scans this list before reading the student's code they'll more likely spot that a certain piece of code might make use of something here and be a good opportunity to introduce it to the student. Otherwise many of these wouldn't come to mind without more time spent on the exercise. I think it can be quite helpful to be introduced to a technique through a real example where it improves the code you've already written - getting a sense of when some of these would be useful is harder in contrived examples imo, but for slightly less common constructions it's easy to miss good opportunities to teach them.
digits = [""] + "one two three four five six seven eight nine".split() | ||
teens = "ten eleven twelve thir four fif six seven eigh nine".split() | ||
tens = ["", ""] + "twenty thirty forty fifty sixty seventy eighty ninety".split() | ||
denominations = (9, 'billion'), (6, 'million'), (3, 'thousand'), (2, 'hundred') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code uses both double quotes and single quotes. Either is fine, but avoid mixing and matching! Consistent code is good code.
I'm also not sure what the value of this code block is. Is there something specific this is calling to a mentor's attention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've fixed the quotes.
Basically since there's a lot of different techniques that can be applied here I wanted to give a third example to cover some more of them. It isn't necessarily intended to show best practice, but some of the techniques used would be suitable for a student to use. I put it at the end because there's already two examples at the top.
Co-authored-by: Isaac Good <[email protected]>
Co-authored-by: Isaac Good <[email protected]>
Co-authored-by: Isaac Good <[email protected]>
Co-authored-by: Isaac Good <[email protected]>
* Integer division and modulo operators, and the divmod function | ||
* Recusion | ||
|
||
Students who wish to extend the exercise can rewrite the function to include 'and' as a seperator as well as handle negative or larger numbers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seperator -> separator
def say(n): | ||
if 0 > n or n > 999999999999: | ||
raise ValueError("input out of range") | ||
if n < 20 and n >= 10: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10 <= n < 20
This exercise currently has no mentoring notes