- Think Python 2e, Chapters 1-3
- Asssignments at this point in the class are graded mostly on documentation, so read this answer to How do I use comments effectively? before submitting your assignment.
- Complete the tutorial at Getting Started with Python on Purdue Cluster Computing to get yourself setup and ready to work through the first three chapters of the Think Python book.
- If you are new to GitHUB, check out the Hello World tutorial from GitHUB to learn the basics.
- If you are working on the Scholar cluster through thinlinc running in the web browser, you will not be able to copy from the desktop into thinlinc. You can either:
- Open the firefox browser inside thinlinc (e.g., type "firefox >& /dev/null &" at the Linux terminal command prompt. The ">& /dev/null" will send warning messages to trash, while the final "&" will run firefox in the background giving you the terminal prompt back - more on this later in the class). You can then copy and paste between firefox and your teminal and spyder windows.
- Install the thinlinc application on your laptop, which will allow you to set the options to allow copying and pasting between thinlinc and the rest of your computer.
- Change to the directory where you are going to save all of your class assignments.
- Clone this GitHUB repository (e.g., "git clone .git"). [for more details, see Getting a Git Repository]
- You can find the repository address to right side of the repository page, by clicking on the button that says "Clone or download".
- This should open a pulldown menu that says "Clone with HTTPS".
- If the window is labeled "Clone with SSH", then click on the link to the right of that message that says "Use HTTPS".
- Under the words "Use Git or checkout with SVN using the web URL." there is a box that will have the web address of this assignment (https://github.com/Environmental-Informatics/assignment-01.git). Select all and copy, or click on the copy address button to the right of the address.
- Paste the address into the "Git clone" command, as shown and press Return/Enter to start the command.
- This will create a new directory that has everything you see in the repository.
- Change into the new directory that resulted from the clone command (e.g., "cd assignment-01").
- Everything you do in this folder can now be tracked and stored with GitHUB.
- To capture the current state of your code:
- Use the command "git status" to see what has changed.
- Red files are changes not tracked by the repositor, green are staged for storage.
- Use "git add " to stage a specific file (will turn from red to green next time you check the status). Or use "git add ." to stage all files in the current directory (and its sub directories).
- Staged files can be committed to the repository using the "git commit" command.
- Using "git commit" by itself will open an editor window where you can add a description of the changes made. This will probably be emacs, so when done typing the description, then type [Ctrl+x Ctrl+s] or click on the disk icon to save the text, then close the window.
- Using "git commit -m "<message>" ", will let you type the message directly on the command line rather than waiting on the editor window to open.
- Finally use "git push" to push the code from your local system to the GitHUB repository. This will require that you provide your GitHUB username and password.
- Once the changes have been pushed, you can see those changes when you reload the GitHUB web site.
- You can clone the repository as many times to as many places as you want, by default it will always be the latest version. However, changes that have not been "staged" to the local repository, "committed" to the local repositry, and "pushed" to the GitHUB repository, will not be reflected in a new clone.
- If you edit on multiple locations, you may also have to use "git pull" to pull changes from GitHUB into an older clone of the repository. Doe this BEFORE you start editing. If not, you will need to read up on merging a pull request.
-
Think Python Chapter 3: Exercises 3.2 [15 pts; do parts 1 through 4 and submit script for part 4, do not write "do_four" script].
- Note: In earlier editions of the Think Python book this problem was numbered Exercise 3.4, as activities within the chapter were also numbered and the first exercise at the end of the chapter was not numbered starting at 1. Make sure that you submit the program called "do_twice" as defined in part 4.
- Save your program as Exercise_3.2.py (if using Python directly) or Exercise_3.2.ipynb (if using Jupyter Notebook) for submission.
-
Think Python Chapter 3: Exercise 3.3.
- Note In earlier editions of the Think Python book this was numbered Exercise 3.5, as activities within the chapter were also numbered and the first exercise at the end of the chapter was not numbered starting at 1.
- Save your program as Exercise_3.3.py (if using Python directly) or Exercise_3.3.ipynb (if using Jupyter Notebook) for submission.