Readings

The readings for Tuesday, January 26 are:

  1. A Byte of Python

  2. Scipy Lecture Notes

  3. Python Course

Questions

Once you have completed these readings, please answer the following questions:

  1. Describe the general goals and principles of Object-oriented programming and how it compares to procedure-oriented programming.

  2. What exactly is a class and what is an object?

  3. What are fields and methods?

  4. Given the class below:

    class Dog(object):        # Thanks, Dan
        def bark(self, n=1):
            ''' Bark n times '''
            for i in range(n):
                print 'Arf!'
    

    What is the self argument in the bark method? Why is it called this and what does it refer to?

  5. Given the class above, write code to do the following:

    # 1. Create an instance of the Dog class
    
    # 2. Use this instance to bark 5 times
    

Feedback

If you have any questions, comments, or concerns regarding the course, please provide your feedback at the end of your response.

Submission

To submit your response, please commit your work (responses and scripts) to the reading02 folder of your your Readings Bitbucket repository.

Layout Change

The instructor has modified the layout of the readings repository to have a folder for each reading. You may wish to do a git pull first to get this updated layout.