Jamie Starke bio photo

Jamie Starke

I develop for my career, but I also develop for fun, and whenever I think it can solve a problem I'm having. This has lead me to create side projects, such as Rental Map and BusTimes, among others.

Consulting Newsletter Email LinkedIn Github Stackoverflow More

If you have not already done so, You should look at Assignment 2. This assignment is not extremely hard, but you may find it tricky in a few places.

The first thing you will need to figure out is the difference between the way points are mapped on the computer display, and the Cartesian co-ordinate system. The Cartesian coordinate system is the same one that you will likely have been working with in your math classes for years.

Second, you will need to algorithmically perform a number of operations. For this, I recommend a while loop. this will look something like the following:

x = 0
while x < 100:
     print x
     x = x + 1

This specific piece of code will print the numbers from 0 to 99. The important thing here is the x < 100 will work exactly like if we used an if statement. That is, it will keep doing the print, until x becomes 100.

Another tool you will likely find useful is doing powers in Python. So for example, your assignment you have y = ax3 + bx2 + cx + d. To do this, we first need to be able to calculate x3. As an example, if I want to just do this, and set it to a variable called x_to_the_3, the code would look like:

x_to_the_3 = x**3

Also, at the end of your program, you will need to see if the user wants to stop. To do this, we will again print to the screen, like we have on previous assignments, but the input on this assignment is different, and looks like:

user_input = raw_input()

user_input here will now contain a string that we can compare to what we expect the user to type in.

You may also find it useful to send somethings to QuickDraw before others. When you have already used print to send some things to QuickDraw, and you want it to send them to screen right away, you can use:

sys.stdout.flush()

This basically tells python, everything you have ready to print, send it now. When QuickDraw receives it, it will draw.

Finally, for those of you who did not use QuickDraw’s Text features on the last assignment, you will want to look into it for this assignment.