-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
gh-107017: Rework the Fibonacci example #107132
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
Closed
TommyUnreal
wants to merge
17
commits into
python:main
from
TommyUnreal:107017_tutorial_introduction_assumtions_removal_fibonacci
Closed
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2383c73
Draft. Rework ´the Fibonacci example.
TommyUnreal f1cd228
Proofread, fixed the PEP 8, doctest.
TommyUnreal 4f8e940
Fix rst formatting and missing literal block
TommyUnreal 2584707
Fix inline literal.
TommyUnreal 1fae12b
Better multichar end arg example in print().
TommyUnreal e87530d
Fix review hints. Explain condition better.
TommyUnreal 10107c1
Fix inline literals.
TommyUnreal cdafb1f
Update Doc/tutorial/introduction.rst
TommyUnreal 3c9bec8
Update Doc/tutorial/introduction.rst
TommyUnreal 6ad0175
Update Doc/tutorial/introduction.rst
TommyUnreal 7722165
Fix multiple assignment example.
TommyUnreal 3c0171e
Corrected grammar errors.
TommyUnreal fbb36a0
Better wording in example comment.
TommyUnreal d9a707d
Fixed typo, improved wording.
TommyUnreal 7e627a4
Fixed missing-space-before-role lint error.
TommyUnreal 33a3b3c
fIXED WARNING: Title underline too short lint.
TommyUnreal 0f51c49
Merge branch 'main' into 107017_tutorial_introduction_assumtions_remo…
hugovk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update Doc/tutorial/introduction.rst
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
- Loading branch information
commit cdafb1fcb2cc22dbfc430b4cd30f944ac24f5350
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -592,7 +592,7 @@ from the Fibonacci series that are lower than 150:: | |
>>> a, b = 0, 1 | ||
>>> while a < 150: | ||
... print('', a, '', end='->') | ||
... a, b = b, a+b | ||
... a, b = b, a + b | ||
... | ||
0 -> 1 -> 1 -> 2 -> 3 -> 5 -> 8 -> 13 -> 21 -> 34 -> 55 -> 89 -> 144 -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And I like the way that the example illustrates the value of using |
||
|
||
|
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.
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 understand that this utilities the print sep param, however this is nor explained nor inferred, so to a beginner it may be confusing
Perhaps it could be beneficial to show off f-strings like
Or to keep end as
->
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 very strongly prefer the original
print('', a, '', end='->')
, which reduces the punctuation the learner has to deal with to a minimum, and emphasises instead the connection between more easily assimilated things, like the English word "end" and the "arrow" ("->").Showing off f-strings while demonstrating a different functionality introduces unnecessary cognitive burden. Two different kinds of quotes and two different kinds of brackets requires a lot of parsing and stopping. I don't think this is the right solution 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.
My reasoning: As this is an Introduction chapter, I wanted to keep the number of introduced concepts to the minimum. There are ways to code this better, but it is not formally wrong. The default separator is already shown in the example above and this just builds on that, so it's hopefully not confusing to the reader.