Hi Karin, I like the example about pixels in an image. For each pixel in an image (row by row), do something, for example convert color to grayscale. Most students have a good intuition about images, pixels, and other media examples.
I think this was from the "media computation" examples in Mark Guzdial's "Why Is It So Hard To Learn To Program" paper: http://files.software-carpentry.org/training-course/2012/08/guzdial.pdf Lukas On Thu, Dec 3, 2015 at 11:19 AM, Juan Nunez-Iglesias <jni.s...@gmail.com> wrote: > Ha! I like the egg metaphor + demo. One thing I would suggest is to change > the variable from "egg" to "egg_in_hand". People in my workshop seemed to > have the most trouble with the idea that each element was being assigned to > the variable name in the for loop. With "egg_in_hand", you can demonstrate > the assignment that's happening. > > Either way, I like all the different applications of your metaphor. You > can teach programming *and* make a cake, all in one session! > > Juan. > > On Thu, Dec 3, 2015 at 9:01 PM, Ian Hawke <i.ha...@soton.ac.uk> wrote: > >> One example that I've used in words, and want to try in reality: >> >> Take an eggbox with one row of eggs. >> >> for egg in eggbox: >> crack(egg) >> >> and then take them out one at a time and crack them (into a jug, I guess). >> >> Alternatively, number the eggs with a permanent marker from 0, and use >> this to display list access. >> >> Main reason for doing this with an eggbox is that it extends to two >> dimensions, so the metaphor can extends to numpy array examples with two >> indices, which always seems to cause more issues. >> >> Ian >> >> >> On 03/12/2015 09:24, Karin Lagesen wrote: >> >>> The more I teach, the more I realize that I am not really able to convey >>> what a for loop does to everybody. Do any of you have a metaphor or >>> something that you use for teaching it? I explain about variables and >>> collections, and the body of the loop, and I show examples, but I am still >>> not able to get through all the time. >>> >>> Karin >>> >>> _______________________________________________ >>> Discuss mailing list >>> Discuss@lists.software-carpentry.org >>> >>> http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org >>> >> >> >> _______________________________________________ >> Discuss mailing list >> Discuss@lists.software-carpentry.org >> >> http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org >> > > > _______________________________________________ > Discuss mailing list > Discuss@lists.software-carpentry.org > > http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org >
_______________________________________________ Discuss mailing list Discuss@lists.software-carpentry.org http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org