To convert between different bases, we can use a form like in this example going from Hexadecimal to Decimal and Decimal to Hexadecimal. Using a similar form to this, we can convert between any base.
Monthly Archive: September 2009
Assignment 1 Part B Starter
Chris Luce gave a good example to help show the basic concepts needed to get started on assignment 1. This example is available Here.
One of the most important things in the assignment is that the user must be able to define where on screen the happy face will show up. A few important things to not on this.
To ask the user for where they would like the happy face, you must first use this command at the very beginning of your program.
import sys
This allows you to use premade stuff in python. Now to be able to send write a question to the user like “Enter an x value: “, you would use
sys.stderr.write("enter an x value: ")
This effectively bypasses QuickDraw, and writes this directly to the terminal.
Now, to get the input from the user you can use
x = input()
If we now wanted to place a circle at the x value provided by the user, we could how use.
print "circle", x, "300 50"
In this example, the circle’s horizontal placement would be set by the user, and the vertical would be in the middle of the window.
For a more specific example, check out Chris Luce’s example Here.
If you have any questions, consult the extra help page
Assignment 1
We will be covering Assignment 1 Part B in tutorial this week. To facilitate this, we will be going over QuickDraw. A This site includes a full set of documentation including many of the primatives and Basic commands that will be needed for the assignments. Also check out the Tutorials for ways to get started on the assignments.
The first lecture this week we will be covering some basic techniques to get started with both Python and QuickDraw. There is a decent tutorial to get you started in Python available Here. Also, Download Quickdraw here early so we can spend more time with working in QuickDraw.
Week of September 21st 2009
I will be out of town from Tuesday the 22nd until Friday the 25th. My tutorials will be covered by the other TAs as follows.
T01 – Chris Luce
T03 – Kate Chatfield-Reed
I will be available by email most of this week, although at times, my responses will likely be delayed.
Extra help and CT Hours for CPSC 217 F09
As you start trying the assignment, remember that if you have questions, there are lots of opportunities are available for help. I am available at the CT Desk from 11 to 1 on Mondays. The CT Desk is located in the farthest Northwest corner of the lab, and has a Big CT Desk sign.
Other TAs for the course are also available as follows:
Thursdays from 12:00 – 13:00 and 16:00 – 18:00
Fridays from 09:00 – 13:00 and 14:00 – 15:00
I can also be contacted by email for additional help, at . Please remember that I am not always at my computer, and it can sometimes take a day or two for me to reply.
Useful Linux Commands
The following are a list of useful Linux Commands that you may want to use during the course.
CAPITALIZED items should be replaced with those described. [Bracketed] items are optional. When in doubt, use ‘man’ to learn more about each command.
| Command | What it does |
|---|---|
| man COMMAND | Show manual for command |
| passwd | Changes your password |
| pwd | Print the current directory |
| ls [-la] | List files in current directory, or all (including hidden) files |
| cd DIRECTORY | Change your current directory |
| gedit [FILE] | Opens text editor, or a specific file in the editor |
| cp SOURCE DEST | Copy a file or directory |
| mv SOURCE DEST | Move a file or directory |
| rm NAME | Remove a file |
| mkdir NAME | Make a new directory |
| rmdir DIRECTORY | Remove a directory (must be empty) |
| python [FILE.py] | Opens the interpreter, or runs a specific python file |
| cat FILE | Print contents of FILE |
| less FILE | Display contents of FILE |
| grep PATTERN FILE | Looks for PATTERN in FILE |
| grep -n PATTERN FILE | Looks for PATTERN in FILE and displays the line number |
| diff FILE1 FILE2 | Shows the differences between FILE1 and FILE2 |
| script FILE | Records everything printed to your screen, Saved to FILE |
| lpr FILE | Prints FILE to the undergraduate printers [More Info] |
| lpinfo | Displays your print status and quota |
| wc [-cml] FILE | word count (displays count of lines, words, and characters in FILE) |
| uniq [-cduf] FILE | Filter out repeated lines in FILE |
| sort [-bfnr] FILE | Sort the lines in FILE |
| cut [-bf] FILE | Cut out selected field/bytes of each line of a file |
| head [-n NUM] FILE | Displays the first ten lines of FILE, unless specified with -n NUM |
| tail [-n NUM] FILE | Displays the last ten lines of FILE, unless specified with -n NUM |

