Wednesday, November 9, 2016

CST 205 Week 2

CST 205 Week 2

The TED talk on the Key to Success being grit was very informative. I have found this to be true in my own life. When there were failures in my life, I can look back and see that a passion and determination were not present at the time which led to failure. With maturity I have learned that "grit" and passion are even more essential to success than intelligence or IQ.

I learned about looping across a range of pixels. Here is how the pseudocode looks for this:

for each x from 0 to x - 1:
    for each y from 0 to y - 1:
        manipulate pixel

or in code

for x in range (0, getWidth(pic)):
    for y in range (0, getHeight(pic)):
        do-stuff-to-pixel(pic, x, y)

The writePictureTo() function allows you to store the manipulated picture in your hard drive. The first variable is the variable for the picture and the second variable is the file location on the hard drive.
In Python you can use the pass statement to skip the body of a conditional statement. This is usually used to keep a placekeeper for a conditional statement to come back to later.

This week I did a lot of photo manipulation using for loops. I found some of the exercises to be challanging and others to be failry easy. I found that a good approach to the challenging problems is to really make a good effort to do thorough pre planning and pseudocode for the exercise. Sometimes I get caught up in the programming and just start without setting up pseudocode. For a harder problem, this can actually make the task last longer. I will adjust my methods for future labs.

No comments:

Post a Comment