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

Programming with Python Episode 3 Example Suggestion #762

Open
CRWayman opened this issue Nov 25, 2019 · 0 comments
Open

Programming with Python Episode 3 Example Suggestion #762

CRWayman opened this issue Nov 25, 2019 · 0 comments

Comments

@CRWayman
Copy link

@CRWayman CRWayman commented Nov 25, 2019

In Episode 3 of Programming with Python, there is an exercise which shows that as a for loop iterates through a string of the five vowels, a variable is updated. I have found that this exercise skips a few logical steps, and that users who are new to Python struggle to understand the outcome of this loop.

I recommend augmenting the loop slightly so that instead of

length = 0 for vowel in 'aeiou': length = length + 1 print('There are', length, 'vowels')

You would have

length = 0 for vowel in 'aeiou': length = length + 1 print(length) print(vowel) print('There are', length, 'vowels')

This would provide a sort of hard-coded enumeration example that could show learners how the steps occur on each iteration, and really drive home the idea that loops are moving through each character in a string. It will only help learners reinforce ideas that are taught earlier in the lesson through repetition.

http://swcarpentry.github.io/python-novice-inflammation/03-loop/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.