Archives For Python permalink

MIT 6.00SC Lecture 2

gerarddolan —  February 18, 2013 — Leave a comment

mitx_med

“MIT OpenCourseWare (OCW) is a web-based publication of virtually all MIT course content. OCW is open and available to the world and is a permanent MIT activity.”

The following are my notes for this program:

Introduction to Computer Science & Programming

Guttag, John. 6.00SC Introduction to Computer Science and Programming,Spring 2011. (Massachusetts Institute of Technology: MIT OpenCourseWare), http://ocw.mit.edu (Accessed 18 Feb, 2013). License: Creative Commons BY-NC-SA

MIT 600 Lecture 2:
Operators and operands; statements; branching, conditionals, and iteration

Lecturers: Eric Grimson & John Guttag
Course Web site

 

 

Lecture 02

2 Fundamental for designing programs* some representation of fundamental data
* a way to give instructions to the computer

Primitive Data =
* numbers
* strings
for these we have a value & a type

Combine in expressions:
* operand
* operators

Interp:
* Eval
* Prints

Script – no printing unless explicit

Type checking – different languages fall on a spectrum of Strong to Weak

Type Discipline:
a) checking out operators or procedures to see what they do under different circumstances
b) what type of arguements or operands to apply to operators

Operator Precedence:
when in doubt use paranthesis

Variables & Values:
done by assigning an Assignment statement

Where can you Variables?
used anywhere that its legal to use the value

Statements =
legal commands that Python can interpret
i.e. Print, Assignment

Sequence of 28 keywords excluded in Python

Straight line programs vs
Branching Programs; is something that can change the order of a program based on a test

Colon identifies a block
Equal sign is an assignment

Test Cases
Have one for each path of the code

Boolean Combination
and, or, not