Join Club ShowMeDo to Learn Python!

This series is a part of Club ShowMeDo. Click to learn why you should join our club with a simple monthly subscription.

  • We teach Python and all the cool modules
  • Topics include beginner Python, GUIs, Web and Desktop Apps
  • Long, specially crafted video tutorials just for you
  • Club video tutorials extend our normal Free content
  • Save your time - we've done the research for you
  • Keep your skills up-to-date
  • Learn at your own pace, everything you need is shown to you
  • Over 12 hours of archived material are waiting for you in the club

Name: [002] Ian Ozsvald
Member: 105 months
Authored: 181 videos
Description: I am the co-founder of ShowMeDo (see http://showmedo.com/about), author of `The Screencasting Handbook <http://thescreencastinghandbook.com>`_ and the founder of the professional screencast production company `ProCasts <http://procasts.co.uk>`_: .. image:: http://procasts.co.uk/media/procasts_sma ...

For on a List [ID:797] (2/7)

in series: Python Beginners - Loops and Iteration

(Showmedo is undergoing major changes. To report any problems viewing the videos please email us and include browser and OS specifics. Cheers - Kyran.)

The 'for' command lets us iterate over a sequence of items, commonly we use it to iterate over the items in a list. This is exactly the use-case I show you here.

We'll also look at using 'break' and 'continue', along with the less-usual 'else' statement (normally you only see 'else' on 'if' statements).

Note that there is an AUDIO TYPO in this episode - I mention 'comment out' when I should be saying 'uncomment' - the mistake is obvious and won't confuse you.

Links:

Got any questions?

Get answers in the ShowMeDo Learners Google Group.

Video statistics:

  • Video's rank shown in the most popular listing
  • Video plays: 391 (since July 30th)
  • Plays in last week: 0
  • Published: 73 months ago

Thank-yous, questions and comments

If this video tutorial was helpful please take some time to say thank-you to the authors for their hard work. Feel free to ask questions. Let the author know why their video tutorial was useful - what are you learning about? Did the video tutorial save you time? Would you like to see more?

You may also want to see our ShowMeDo Google Group to speak to our active users and authors.

Your email address will not be published.

Show some quick comments >>








All comments excluding tick-boxed quick-comments

Good quick basics with clear examples.

Thanks!


I tried creating a .txt file and opening it in the same manner (using IDLE python shell) and I couldn't get it to work. Could you elaborate what I need to to do the file so that it opens? Or any extra code that may be required to open a file?


Useful example.

I think it should be mentioned that the result of the iteration is a list construction, so further work on the iteration result can be done. Similarly, when reading from file (one of the most important issues in my opinion, no very developed in showmedo by the time of this writting), every read line is a list, so for an iteration you should have nested list (isn't it???).

Evaristo


Hi Ian, great screencast. I have a question - is there a way to use a for loop to name variables? I want to name variables according to the items in a list, but concatenating variable names is proving tricky...


Good job Ian. This vidoe explains well using for loops and lists and options to use within the loop. Thanks, Thomas


great job, I now understand the usage of break and continue. Thanks


simple overview on the power of for statements.

Thanks again Ian.


I always wondered how I should end the for loop. Now I see it can be done with else. Thank you!


Review of For on a List

I didn't know about the for/else construct. Bravo!


Very well done. The example is comprehensive, yet simple to understand - especially the way you present it.

In terms of pedagogical approach, I can not think of a simple improvement. Well done!

I do find the change of windowing, from viewing the code (on a white background) to the result of the execution (on a black background) slightly distracting. Also, it is not possible to pause the video and view at the same time the code executed and the output.

(Here's a biased suggestion...) I think this example could be more nicely done using Crunchy (with the editor mode). You could display the code (with syntax coloring) in a similar way and execute it by clicking on a button - with the output appearing just below. As an added bonus, you could also display the code from python.org in the same window - either a different tab or, if you wanted to be "fancy", in the same tab, with your code in an editor below the code from the Python site.


I did not know about the "else" conditional for loops. Thank you for sharing that.


The ShowMeDo Robot says - this video is now published, thanks for adding to ShowMeDo.


Your video has been edited. This is an automatic post by ShowMeDo.


Your video has been edited. This is an automatic post by ShowMeDo.


Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

Kudos and Thanks for Ian

Content

Feedback

Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.

feedback@showmedo.com