CS206: Data Structures

Spring 2016

Professor Blank

Assignment #1

Should be timestamped before start of class on Tuesday, January 26, 2016.

  • Topic: Notebooks, editing, code, and reflections.
  • Description: For this assignment, you will create your first notebook, create a title, by-line, execute code, and provide a reflection.

Grading rubric:

  • 10 pts Title
  • 10 pts By-line and description (what is this?)
  • 40 pts Code
  • 40 pts Reflection

NOTE: there is a spelling checker (the check-mark button next to "CellToolbar"). Turn it on.

Assignment Process:

  • Copy the file /tmp/nbgrader_config.py to your home directory (one-time thing)
  • Go to the Assignments tab on the dashboard
  • Fetch the assignment
  • Open "My First Notebook.ipynb"
  • Edit it to include the four sections of the rubric
  • Submit it (at least once)

Your notebook might look like:

but that is lame. This is the structure of notebooks that you will submit all semester long.

What makes a good Reflection?

  • write about this project/aspect/topic of the course
  • note what you learned
  • what did you find challenging? easy? tricky? rewarding?
  • connect this material to your personal interests

What makes for good code?

  • try out some things
  • use: variables, booleans, ints, functions, if/else, loop
  • be creative! have fun!

NO CREDIT FOR LATE SUBMISSIONS

Here are two lines in a notebook or terminal that will activate the grading extension:

In [1]:
int size = 500;
|  Added variable size of type int with initial value 500

In [2]:
printf("Hello");
Hello
In [3]:
System.out.println("Hello!");
Hello!

In [4]:
int year = 2016;
|  Added variable year of type int with initial value 2016

In [5]:
(year % 4) == 0
|  Expression value is: true
|    assigned to temporary variable $5 of type boolean

Out[5]:
true
In [8]:
boolean is_leap_year(int year) { 
    if (year % 400 == 0 ) {
        return true;
    } else if ((year % 100) == 0) {
        return false;
    } else if ((year % 4) == 0) {
        return true;
    } else {
        return false;
    }
}
|  Added method is_leap_year(int)

In [9]:
is_leap_year(2100)
|  Expression value is: false
|    assigned to temporary variable $7 of type boolean

Out[9]:
false
In [10]:
printf("%s is %s", 1943, true);
1943 is true
In [11]:
void hello(String name) {
    printf("Hello, %s! How are you?", name);
    System.out.println("Hello, " + name + ". How are you?");
}
|  Added method hello(String)

In [12]:
hello("Sally");
Hello, Sally! How are you?Hello, Sally. How are you?