Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

This page removed for FERPA compliance
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

What to do if you don't understand a program?

The goal of your understanding should be to be able to PREDICT exactly what the program is doing. Really – you should be able to explain what's happening at every line and what every value is. If you don't understand it at that level, you don't really understand it.

Think about it as instructions to a small child who understands only a few commands. REMOVEDw do you make sure that the child can follow the commands? You try them out on yourself, so that you understand what should be happening at each step. Understanding a program works the exact same way.






An important way to change a program to make it REMOVED understandable is to break complex single lines into multiple lines.
    setRed(p,getRed(p) * 1.2)
is the same thing as
    value = getRed(p)
    newvalue = value * 1.2
    setRed(p,newvalue)
And to see what's going on while it's running, you can change that into:
    value = getRed(p)
    print "Value=", value
    newvalue = value * 1.2
    print "New Value =",newvalue
    setRed(p,newvalue)



Comments and questions?





Link to this Page