Session 2 Preparation — Videos, Reading and Quizzes

The preparation time you will need for Sessions 2 and 3 is longer than what you will need for most later sessions. Start this work as soon as you can after class; plan to do a few of the items. Take a break and come back to later items. That will be much more fun and better for your learning than doing it all in one sitting.

Quizzes:

Do this Quiz on Session 2 as you watch the videos and do the reading (as listed below). This document is a Microsoft Word document; here is the same Quiz on Session 2 (pdf) as a PDF.

You can either:

In either case, turn it in via the Session 2 Dropbox on our Moodle site.

Videos and Reading (online and textbook):

All of the following are required except the items labeled Optional are, well, optional (i.e., things that may be interesting but do not directly pertain to your success in this course).

  1. Introduction to Session 2
    • Video (embedded in a web page) [3:14 minutes]
    • Video (as an mp4 that you can download if you want: 7.41 MB)
  2. Getting started in Python via the PyDev Console — Objects, Types, Variables, Assignment and more
    1. In Session 1, you probably completed a handout on: If you did NOT do the exercises in that handout, do them now.
    2. Now work through the follow-up PyDev Console exercises in: See the first handout above if you need a refresher on how to open a PyDev Console.

      Important:

      • If you began this exercise in Session 1, simply continue from where you left off.
      • There is nothing to save or turn in; just do this exercise per its instructions and LEARN from it!
      • You are likely to have questions from this exercise: simply bring your questions to Session 2.

  3. Variables
    • Textbook reading: Section 2.1 — Variables (7 pages).
      • The link is to a scanned copy for your convenience. The real textbook is easier on your eyes.
      • Important: To be efficient in doing this reading, focus on these key ideas:
        • What is a variable? How do you assign a value to a variable?
        • What is a type? What is the difference between a float and an int?
        • What is a string? What is the difference between the following two statements?
              x = 4
              x = "4"
          
        • What is a comment? Why are they important, and to whom?
        • Common Error 2.1 on page 36: Using Undefined Variables
        • Programming Tip 2.1 on page 36: Choose Descriptive Variable Names
        • Programming Tip 2.2 on page 37: Do Not Use Magic Numbers
  4. Input-Compute-Output Programs
    • Video (embedded in a web page) [8:36 minutes]
    • Video (as an mp4 that you can download if you want: 18.1 MB)
    Additionally, read this Annotated Input-Compute-Output Program that the video walks you through.
    • Do NOT expect to understand EVERYTHING in it in full detail yet!
    • But do BRING your QUESTIONS about it to class.
  5. Calling Functions
    • Video (embedded in a web page) [3:22 minutes]
    • Video (as an mp4 that you can download if you want: 5.64 MB)

    Additionally, here is a handout on Calling Functions that you might find useful as a reference or quick read.

  6. Arithmetic
    • Textbook reading: Section 2.2 — Arithmetic (8 pages).
      • The link is to a scanned copy for your convenience. The real textbook is easier on your eyes.
      • Important: To be efficient in doing this reading, focus on these key ideas:
        • Using expressions that involve addition, subtraction, multiplication, and division.
        • The ** operator for exponentiation.
        • The modulus (remainder) and floor division operators. See Table 3 on page 39.
        • How to call a function, sending it arguments, and capture the returned value in a variable. See the Syntax 2.2 diagram on page 40.
  7. Coding to a Specification
    • Video (embedded in a web page) [4:23 minutes]
    • Video (as an mp4 that you can download if you want: 7.20 MB)
  8. First do it by hand!
  9. Preview of a Session 2 Exercise — An Optional Live Coding Example
    • This video is Optional (but read this note): This long (20 minute) video shows a professor doing the very same exercise that YOU will do at the beginning of your in-class Session 2.
    • As such, watching it may be a great way to walk into class confident of success.
    • But if you run short of time, you can also watch it later, or just ask us questions when you are doing in-class Session 2.
      • After all, that is the POINT of doing the (challenging) exercises IN-CLASS — we are there to answer your questions RIGHT AWAY.
    • So, use your own judgment for how much or little time you want to spend watching this video.
    The video is:
    • Video (embedded in a web page) [19:39 minutes]
    • Video (as an mp4 that you can download if you want: 74.3 MB)
  10. Examples from Session 1

    If you have not already done so, browse the modules (files) from your Session 1 project (checked out from Subversion using Subclipse). For each example:

    • RUN the module.
    • Look at its code and try to see what each statement seems to do.
      • Do NOT expect to understand all the code in all the examples!
      • In particular, the chaos_loop and graphics examples feature several ideas that we will be discussing in Sessions 3 and 4 (but not yet!).
      • The hello_world and hello_goodbye and input_compute_output examples should make some sense to you after you have done the above videos/reading/quiz. You will investigate the ideas from those examples in class during Session 2.