Round 1.4 For loops --- Emily Jane

Oct 31, 2012 • Emily Jane McTavish

My topic is for loops. Really simple, but also easily confusing for new programmers.

Notebook in nbviewer:

http://nbviewer.ipython.org/urls/webspace.utexas.edu/ebm447/www/Forloops.ipynb

 

1.) When teaching, I would talk through the concept map generally, then type in the commands in the notebook as we go- so they can see me make lots of typos and figure things out!
2.) I would make the whole notebook available outside of class, and add in a few- “figure this problem out” cells, with solutions posted elsewhere.

3.) I wanted to explore the concept from Bret Victor’s talk of dynamically experiencing the outcome of changes as you make them. This is a whole lot less pretty here than in his demo, but I think could be really useful for students trying to understand how loops work. Although there are probably better ways, I do this here the way I do in my own code, which is with a whole lot of print statements. By repeating things while adding I think it calrifies how complex statements are built. I also think it is valuable to demonstrate bugs and include code that will not work.