swcarpentry / python-novice-gapminder

Plotting and Programming in Python
http://swcarpentry.github.io/python-novice-gapminder/
Other
164 stars 431 forks source link

Add example for failing type conversion #573

Closed crlna16 closed 1 year ago

crlna16 commented 3 years ago

Added an example where the type conversion from str to int fails for illutrative purposes. It is a common error and it is good for beginners to see it explicitly.

Instructions Thanks for contributing! :heart: If this contribution is for instructor training, please email the link to this contribution to checkout@carpentries.org so we can record your progress. You've completed your contribution step for instructor checkout by submitting this contribution! Keep in mind that **lesson maintainers are volunteers** and it may take them some time to respond to your contribution. Although not all contributions can be incorporated into the lesson materials, we appreciate your time and effort to improve the curriculum. If you have any questions about the lesson maintenance process or would like to volunteer your time as a contribution reviewer, please contact The Carpentries Team at team@carpentries.org. You may delete these instructions from your comment. \- The Carpentries
alee commented 2 years ago

Thank you for the PR @crlna16 ! This example is appreciated, but we have a similar exercise already in http://swcarpentry.github.io/python-novice-gapminder/03-types-conversion/index.html#strings-to-numbers where we try to convert int('3.4') - it might be good to reiterate though, thoughts from others?

vahtras commented 2 years ago

Such an example makes more sense in this subsection (Must convert. http://swcarpentry.github.io/python-novice-gapminder/03-types-conversion/index.html#-must-convert-numbers-to-strings-or-vice-versa-when-operating-on-them..) than the old example (under Variable only change http://swcarpentry.github.io/python-novice-gapminder/03-types-conversion/index.html#variables-only-change-value-when-something-is-assigned-to-them ..) Would be good to clean up the sections to focus on type conversion and assignment separately which are very different topics with their own set of difficulties.

Olav

On Mon, May 16, 2022 at 7:08 AM A Lee @.***> wrote:

Thank you for the PR @crlna16 https://github.com/crlna16 ! This example is appreciated, but we have a similar exercise already in http://swcarpentry.github.io/python-novice-gapminder/03-types-conversion/index.html#strings-to-numbers where we try to convert int('3.4') - it might be good to reiterate though, thoughts from others?

— Reply to this email directly, view it on GitHub https://github.com/swcarpentry/python-novice-gapminder/pull/573#issuecomment-1127226223, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLLJBLITTYWFCZUJGYBSU3VKHJ4LANCNFSM5FTPYPOQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

alee commented 1 year ago

closing this PR in preparation for a Carpentries-wide lesson infrastructure upgrade. Please feel free to resubmit after the Workbench upgrade / discuss in #600