$ update21 course directory does not exist running /home/newhall/classes/cs21/s17/scripts/init.sh Initial setup complete type 'cd cs21' to see files $ ls # ls list the contents of the current directory cs21/ $ cd cs21 # change into the cs21 subirectory $ ls labs/ $ pwd # pwd prints the path of the current directory /home/tnas/cs21
on the center toolbar. You will automatically be placed in your home directory. Typically you do not want to put files here, but rather you want to edit files in a cs21 sub-directory. Use the cd command to get to proper directory. For example, for lab 01, you need to save files in the cs21/labs/01 directory.
$ cd # starting from your home directory $ cd cs21/labs/01/ $ ls $ pwd /home/tnas/cs21/labs/01Use TAB-completion to help navigate the directories quickly.
If you get a No such file or directory error when you type cd, try some of the following:
If you get a Not a directory error when you type cd, you went one level too far. See a sample error and fix below:
$ cd $ ls Desktop/ Documents/ cs21/ $ cd cs21/labs/00/bio.txt -bash: cd: cs21/labs/00/bio.txt: Not a directory $ cd cs21/labs/00/ $ pwd /home/tnas/cs21/labs/00 $ ls bio.txt $
$ vim acres_to_yards.pyIf the file already exists, the above command will edit the file. If the file does not exists, the file will be created the first time you save your vim session. Press i to start editing in vim. When you would like to save, type <ESC>:w. To go back to editing, type i again.
Remember the key elements of a basic program:
A full sample program is shown below:
"""
A sample python program
(Tia Newhall, 1/16/2017)
"""
def main():
print("welcome to cs21")
main()
on the center toolbar again to open a second terminal window. Use cd as described above to navigate to the same directory as the file you are editing. Once in the proper directory, type python followed by the name of your program.
$ python acres_to_yards.pyIf there are errors or things you would like to change, go to your vim window and make changes. Don't forget to save your changes before trying to run the program again using python.
$ pwd /home/tnas/cs21/labs/01 $ vim acres_to_yards.py $ handin21 # handin21 lists newly changed files Submitting the following files: # since your last handin21 run: labs/01/acres_to_yards.pyYou can also run handin21 with -v to list recent submissions:
$ handin21 -v Updates in the past week: ...
At the due date and time, we grab the most recent version of your lab solution that you submitted via handin21. We strongly encourge you to not run handin21 after the due date just in case you forget to run handin21we can verify the date of your solution by the file modification date (but remember to run handin21).
icon from the center toolbar to get the log out menu. PLEASE only select
logout (don't reboot or shutdown the machine).
If you are going to step out of the lab for a few minutes, it is a good
idea to run xlock your machine. You can do this by typing in xlock
at the shell prompt, or by choosing the
icon on the center toolbar.
You should not xlock a machine for more than about 10 minutes so that other students can use the machine; xlock is for a short break.