DS4UX (Spring 2016)/Day 1 lecture

From CommunityData

Part 1: Why Programming and Data Science[edit]

The question of who controls our technology, our information, and our data, is increasingly the question of who controls our experience of the world and each other. Programming is the power to define technology. It can be in, this sense, deeply empowering.

In a technological and data driven world, being able to programming and data science is a kind of literacy. Imagine a world in which everybody could read by only some people could write?

Our goal here is not turn you into the programming equivalent of novelists or journalists. Our goal is to demystify things and give you enough information to become dangerous.

Programming, you will also find — probably a little today and a lot more later on — is also enormously fun. For me, it's like meditation and problem solving. It's exactly as frustrating as a difficult puzzle and even more rewarding because your solution accomplish something else you were trying to do.

Why Python?[edit]

Python is a fantastic language to learn[edit]

Believe it or not, compared to other programming languages:

  • Python has a low "syntatic overhead".
  • It's easy to get work done quickly.
  • It's relatively forgiving.

Python is versatile useful for a range of applications[edit]

There are easier programming languages to learn. But Python is important because it is not a toy. In designing the curriculum for this course, I have tried to only teach tools that professional data scientists and programmers use themselves and find useful.

Python is used for:

  • Big Companies — Big companies like Google use Python to run much of the code that collects all the webpages that go into their search results.
  • Web applications (Instagram, Pintrest, and the Washington Post all run websites written largely in Python).
  • Python can be used to extend existing applications. You can use it to script many graphical applications.
  • Python can be used to build graphical games (e.g., Civilization 4; Frets on Fire is a free version of Guitar Hero)
  • Python is used for movies and graphics (e.g., Industrial Light and Magic; Disney Feature Animation)
  • One of the langauges for science (national weather services, NASA, genomics reseachers)
  • Python really shines when it comes to dealing with data and with the web.

Looking back: where did this course come from?[edit]

Looking ahead: other tools of the trade[edit]

  • MySQL
  • Jupyter notebooks

Part 2: Basic Python concepts[edit]

  • math
  • addition
  • subtraction
  • multiplication
  • division
  • types (int and float)
  • variables
  • assignment
  • types
  • naming
  • types (booleans)
  • equals, not equals, gt, lt
  • evaluate single
  • type
  • evaluate multiple
  • types (string)
  • strings vs numbers
  • quoting and escaping
  • concatenation (same type, different types)
  • char position
  • length
  • functions
  • type again
  • exit
  • help
  • common string functions (upper, lower, index)
  • string operators (in)
  • print
  • if statements
  • indenting
  • compound conditionals
  • variable vs literal evaluation
  • changing variables conditionally
  • else, elif

  • python vs ipython
  • comments
  • printing
    single line printing
    multiline printing
    advanced if/then example