[Recursion Concept]: Fixed Typos & Formatting#4209
Open
BethanyG wants to merge 1 commit into
Open
Conversation
39 tasks
Yrahcaz7
reviewed
May 27, 2026
Contributor
Yrahcaz7
left a comment
There was a problem hiding this comment.
Mostly looks good, I just have a few suggestions and nitpicks.
| Functions that call themselves are known as _recursive_ functions. | ||
| Recursion can be viewed as another way to loop/iterate. | ||
| And like looping, a Boolean expression or `True/False` test is used to know when to stop the recursive execution. | ||
| And like looping, a Boolean expression or `True / False` test is used to determine when to stop the recursive execution. |
Contributor
There was a problem hiding this comment.
Suggested change
| And like looping, a Boolean expression or `True / False` test is used to determine when to stop the recursive execution. | |
| And like looping, a Boolean expression or `True`/`False` test is used to determine when to stop the recursive execution. |
| day_num -- the day of the month currently being processed | ||
| output -- the list to be returned | ||
| Arguments: | ||
| year (int): The year (e.g. 2022)/ |
Contributor
There was a problem hiding this comment.
Suggested change
| year (int): The year (e.g. 2022)/ | |
| year (int): The year (e.g. 2022). |
|
|
||
| She is a little concerned that the recursive approach uses more steps than the looping approach, and so is less "performant". | ||
| But re-writing the problem using recursion has definitely helped her deal with ugly nested looping (_a performance hazard_), extensive state mutation, and confusion around complex conditional logic. | ||
| It also feels more "readable" - she is sure that when she comes back to this code after a break, she will be able to read through and remember what it does more easily. |
Contributor
There was a problem hiding this comment.
The hyphen ("-") here should be an em-dash ("—").
| @@ -118,10 +129,11 @@ | |||
|
|
|||
| Even later, when she learns about `tuples`, Adya could consider further "optimizing" approaches, such as using a `list comprehension` with `Calendar.itermonthdates`, or memoizing certain values. | |||
Contributor
There was a problem hiding this comment.
The tuple concept could be linked here (and maybe the docs for Calendar.itermonthdates too). It's not really necessary, I just thought it might be helpful for curious readers.
| Recursion is a way to repeat code in a function by the function calling itself. | ||
| It can be viewed as another way to loop/iterate. | ||
| Like looping, a Boolean expression or `True/False` test is used to know when to stop the recursive execution. | ||
| Like looping, a Boolean expression or `True / False` test is used to know when to stop the recursive execution. |
Contributor
There was a problem hiding this comment.
Suggested change
| Like looping, a Boolean expression or `True / False` test is used to know when to stop the recursive execution. | |
| Like looping, a Boolean expression or `True`/`False` test is used to determine when to stop the recursive execution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per Issue 4165.