Computer Science I for non-majors by James Tam Return to the course web page

CPSC 217: Assignment 1

Raw score Letter
29 - 30 A
27 - 28 A-
25 - 26 B+
23 - 24 B
21 - 22 B-
19 - 20 C+
17 - 18 C
15 - 16 C-
13 - 14 D+
11 - 12 D
  9 - 10 D-
  < 9 F

New Concepts to be applied for the assignment

Part I: Introduction to UNIX, using common commands (18 marks)

On the UNIX workstations in the Computer Science lab complete the following steps:

  1. Login to your UNIX account*

  2. Start a script session *

  3. Show the contents of your home directory

  4. Show your location (path) in the UNIX file system

  5. Make a new directory called '217'

  6. Show the contents of your home directory

  7. Enter the newly created ‘217’ directory

  8. Show the contents of the newly created ‘217’ directory

  9. Show your location (path) in the UNIX file system

  10. Go to the official directory for CPSC 217 (/home/courses/217)

  11. Show the contents of the CPSC 217 directory

  12. Show your location (path) in the UNIX file system

  13. Go to the directory for Assignment 1 (/home/courses/217/assignments/assignment1)

  14. Show the contents of the Assignment 1 directory

  15. Show your location (path) in the UNIX file system

  16. Display the contents of the file called 'index.txt' onscreen.  Show the file one screen a screen at a time (with a prompt for the user to continue) rather than all at once.  [JT's comment: This step may result in a small amount of 'garbage' or nonsense text appearing on your paper printout.  If the garbage only appears for this step (partway through the display of this file) and/or each of your steps is clear enough for your marker to see each distinct step then you can still get full marks for this assignment.]

  17. Try to delete the 'index.txt' file [JT's Hint: you aren't supposed to be able to complete this step successfully but instead you should get an error message.]

  18. Copy the file to the newly created ‘217’ directory that you created in your home directory

  19. Go to the 217 directory that is located in your home directory

  20. Show the contents of the ‘217’ directory.  (It should include the file 'index.txt' now.)

  21. End the script session*

  22. Submit your assignment (the file called "typescript" using the submission mechanism described on the course web page [UNIX submit program]).*

The lines marked with a star '*' don't directly yield any marks but must still be completed in order for this part of the assignment to be marked.

Part II: Creating your first Python program (12 marks)

You are to write a Python program that will display the following information about the planets in our solar system using the 'print' function.1

Planet   Diameter (km)
Mercury   4,880
Venus   12,100
Earth   12,760
Mars   6,800
Jupiter   143,800
Saturn   120,000
Uranus   52,300
Neptune   49,500

Your output should match the formatting of the data in the table (planet names right aligned, diameter size left aligned). The alignment should be implemented by using the 'field width' property of the print function and not by manually inserting spaces. Your program will only has to display the formatted data when it's run, it doesn't have to implement other features.

Submit your Python program using the submission mechanism described on the course web page [UNIX submit program]).

1 Source "Universe" by Kaufmann W.J. III (WH Freeman and Company 1985)

Marking:

Feature

Marks

Displays the planetary information shown in the table (0.5 per row)

4

The planet column is right justified by setting the field width property (no marks for hard-coding spaces)

4

The planet column is left justified by setting the field width property (no marks for hard-coding spaces)

4

TOTAL

12