?

Log in

No account? Create an account

Previous Entry | Next Entry

Video notes
Lec 1 | MIT 6.00 Introduction to Computer Science and Programming, Fall 2008 - 53:30
http://www.youtube.com/watch?v=k6U-i4gXkLM&feature=related

Declaratif knowledge - facts, truths
imperative knowledge - steps, recipes

First computers were fixed program computers such as calculator, designed to do one specific thing. Turing Bombe was designed to break German Enigma codes during World War 2.

Interpreter is an example of a Store Program Computer. Code gets stored in memory. There is a program counter, which points to first instruction of the code. After each instruction the counter increments. Recipes are based on small sets of primitives. Fixed sets of primates, good programmer can program anything. In 1936 Turing stated that with 6 primates he can program anything mechanical. Anything you can do in one language you can do in another - that's Turing comptability. To describe primates we need a language. There are at least hundreds of programming languages. There is no best language, but some are better suited than others. Lisp is good at arbitrarily structured data sets.

In this course we'll learn a new language, Python. It's not about programming in Python, it's about using it to think. Important to know if it's high level or low level language. High level has richer set of primitive things. Is it a general or a targeted language? Do the primates support broad applications or not. Is it an interpreted or a compiled language. The interpreter is operating directly on the code at run time. In compiled languages, there's an intermediary compilation into object code. Interpreted language are easier to debug, but compiled languages are faster in execution. Python is a high level language, general purpose language, interpreted. Our goal is to build recipes - to break down problems into computational steps. We must learn to describe and for that we need a language. Syntax vs semantics. Syntax is What are the legal expressions? Static symantrics says which programs make sense. ex. My desk is Susan. Syntatically correct but has no meaning. On the other hand there's Full Symantics. What does the program mean? What will happen when I run it? Python has a built-in syntax checker. Python will try to catch static semantics. Code could loop forever, crash. To deal with these problems we need to develop style - easy to spot semantic bugs.

To create any expressions we need values - primitive data elements. In python we have numbers and strings. Numbers are 3, or 3.14. Strings are defined with open and closed quotes, such as "string". 3 is an integer, a type of value. 3.14 is a float. Associated with types are operators that expect specific inputs and outputs. We have simple operations. For numbers we have simple arithmetics. For numbers it's operand operation operand, 3+3. When we build code we'll start using commands. In Python commands show up in different colour. The function print can be used to do basic arithmetic or to print strings. print "hello" would result in hello. print 3+5 would result in 8. print "hello"*3 would result in hellohellohello.

Profile

success
maslacak
Future Master

Latest Month

September 2012
S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
30      
Powered by LiveJournal.com
Designed by Tiffany Chow