Skip to content
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

Changed first example function in Errors and Exceptions to execute a … #550

Open
wants to merge 1 commit into
base: gh-pages
from

Conversation

@aahowel3
Copy link

@aahowel3 aahowel3 commented Jun 14, 2018

…practical command rather than a list of ice creams. In student's experience functions are designed to do something. New example function also incorporates if/else statements learned in previous lesson.

…practical command rather than a list of ice creams. In student's experience functions are designed to do something. New example function also incorporates if/else statments learned in previous lesson.
@@ -70,16 +66,16 @@ You can determine the number of levels by looking for the number of arrows on th
In this case:

1. The first shows code from the cell above,
with an arrow pointing to Line 8 (which is `favorite_ice_cream()`).
with an arrow pointing to Line 9 (which is `lucky_dice(3)`).

This comment has been minimized.

@maxim-belkin

maxim-belkin Jun 14, 2018
Contributor

Line 1 ?

This comment has been minimized.

@aahowel3

aahowel3 Jun 14, 2018
Author

1 as in the first level of the traceback.

This comment has been minimized.

@maxim-belkin

maxim-belkin Jun 14, 2018
Contributor

my bad! Line 9 is correct

@maxim-belkin
Copy link
Contributor

@maxim-belkin maxim-belkin commented Jun 14, 2018

Thanks for the PR, Abigail. I'm not yet sure what I think about it, but the content-wise it looks good to me. If you could provide a better justification as to why this part should be changed - that would be very much appreciated.

outcomes=['win','lose']
if number >= 6:
print(outcomes[1])
if number < 6:

This comment has been minimized.

@maxim-belkin

maxim-belkin Jun 14, 2018
Contributor

else?

This comment has been minimized.

@annefou

annefou Jun 18, 2018
Contributor

Yes definitely "else". I am not sure this new example is clearer. I agree the initial example can be found a bit unrealistic but the main advantage is that it is fairly straightforward. I wonder if we would divert attendees by adding complexity while our main objective is to demonstrate how python tackles errors.

print(outcomes[1])
if number < 6:
print(outcomes[2])
lucky_dice(3)

This comment has been minimized.

@maxim-belkin

maxim-belkin Aug 13, 2018
Contributor

what if we change our example to:

def select_favorite(items):
    print(items[3])

ice_cream = ["chocolate",  "vanilla", "strawberry"]

select_favorite(ice_cream)

Would that be any better?

@maxim-belkin maxim-belkin force-pushed the swcarpentry:gh-pages branch from 4753644 to 90848ea Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.