Skip to content

Latest commit

 

History

History
163 lines (141 loc) · 9.27 KB

week02.md

File metadata and controls

163 lines (141 loc) · 9.27 KB

Week 2

General

  • There's a wide range of backgrounds in the class -- it's expected and good to see.
  • Grading will be based on how much you learn, not on how your background compares with others.
  • There's a lot of information. We're diving right in. There's no wading involved.
  • So ask questions!! There will be major awards for both asking and answering (in Piazza and in class)
  • As for Major Awards -- I'm keeping track, it'll be part of the class-participation score.
  • Make use of office hours! If office hours aren't convenient for you, just make an appointment.

Overview

A list of notebooks so far (like book chapters, except there's no book)...

JavaScript for Python Programmers

  • JavaScript for Python Programmers
    • This was required reading -- Review it briefly.
    • Let's skim through it and see if there are any questions.
    • We won't go into great detail.
    • This is something you should keep handy and look at periodically.
  • Introduction to Code
    • This is an alternative with much of the same information, not Python-centric

Observable for Jupyter Users

  • Assigment #1 had two notebooks for required reading:
    • JavaScript for Python Programmers
      • In principle, we could have a quiz on this required reading from the assignment.
    • Observable for Jupyter Users
      • This was required reading -- Review it briefly in class
      • In principle, we could have a quiz on this required reading from the assignment.
      • If we were to have a quiz, this is what some of the questions would look like...
  • Demo quiz questions
    • Question 1: In Jupyter notebooks, it's implicit that the "repr()" -- printable reprepresentation -- of the last expression gets printed below the cell. What's implicit from an Observable notebook cell?
    • Multiple choice answers
      • The value of the last expression gets printed.
      • A string equivalent of the last expression is printed below the cell.
      • A string equivalent of the last expression is printed above the cell.
        • This is only true if you return a string.
      • Undefined.
        • THIS IS THE CORRECT ANSWER -- You must explicitly return values
      • None of the above
    • Question 2: How many types of cells are there
      • 1 -- THIS USED TO BE THE CORRECT ANSWER -- JavaScript -- that's what it says in the reading, but it's out of date
      • 2
      • 3
      • 4 -- THIS IS SORT OF THE CORRECT ANSWER -- that's how many there are now (if you create a new cell)
        • The two sort-of-answers are reconciled by understanding the role of the standard library
        • This would have been a trick question in a quiz, and students would have been justified in objecting;-)
        • Observable standard library
    • Question 3: Multi-line code cells are surrounded by...
      • white space
      • square brackets
      • curly brackets -- THIS IS THE CORRECT ANSWER
      • parentheses
    • Question 4: If you create two cells named "a" and run them in sequence then
      • The first cell in the sequence wins and determines the value of "a"
      • The second cell in the sequence wins and determines the value of "a"
      • None of the above -- THIS IS THE CORRECT ANSWER -- you'll create a runtime error
    • Question 5: When you press "Cmd-Enter", Observable cells run as follows:
      • All cells run from top to bottom
      • Only the individual cell runs
      • All cells above the current cell run first, then the current cell runs
      • None of the above -- THIS IS THE CORRECT ANSWER
        • The current cell will run along with any cells that depend on the return value will also run.
        • The cells run in execution order.
        • How Observable Runs

Introduction to Data

Observable Inputs

EXERCISES (in-class)

HTML and CSS

  • html.md -- This is the minimal answer to last week's assignment
  • Basic HTML page (not covered in class)
    • createElement -- MDN
      • This MDN reference compares basic HTML with same content created dynamically with JavaScript (good demo)
      • Note: Our goal is not to get super into the weeds of Web technologies
      • MDN is a great resource (bottom of the page has browser compatibility)
      • Google "javascript map mdn" and look at the compatibility
      • ES6 -- ECMAScript -- wikipedia
  • Note: On Github, markdown gets formatted automatically into a web page, giving you CSS with Jekyll

Observable Plot

  • Learning goals
    • Quick Plot for tabular data with sensible defaults (e.g., in Python: Seaborn)
    • Customizable (e.g., in Python: Seaborn is built with Matplotlib)
    • Memorable API designed with extensibility in mind (e.g., in Python: Um, wait. Is that Seaborn or Matplotlib?)
  • Observable Plot -- mbostock notebook

EXERCISES (in-class)