Class Notes (809,201)
Canada (493,576)
Lecture 1

ENGINEER 1D04 Lecture 1: 1D04 lecture notes summary feated with chinese citation notes

7 Pages
Unlock Document

McMaster University
Engineering (General)
Ned Nedialkov

Lecture summary Professor Dr. Ned Nedialkov CR to Edward Yu 知识点 人物 重点&难点 Lecture 1 Total BS Lecture 2 Values: s are the information (called data) stored and manipulated by computer program. Including Booleans (True false); Machine integers (小的整数); Floating point numbers; Strings; Lists; Functions. Expression: An expression is a syntactic entity that denotes a value. [分为 atomic 和 compound expression] Data type: syntactic entity that denotes a collection of values of similar form. 包括 Bool; int; float; str; list Type error 在用错 type 的地方,比如在 int 的地方放入一个 string Variable: a linguistic entity whose meaning can vary. [name bound to a value] *readable and writable Constants: linguistic entity whose meaning is fixed. [Immutable variables] Built in constants 如 true and false Statements: a syntactic entity that states something to be done. 包括 for while if try-expect def. Ada Lovelace: First woman programmer. 1843 写完 Charles Babbage 的 Analytical Engine Modes of program execution: 1. Be interpreted line by line. 交互式强;容易 debug, 速度慢 2. Be compiled into byte code 可 portable;比 native 慢 3. Be compiled into native machine code. 非常快;难编 Lecture 3 Number system: 1. Natural number 2. Integers 3. Rationales 4. Real number 5. Complex number 二进制和十进制转换: 从个位开始未 2^0 2^1 2^2 2^3…. 再乘上该数位的 coefficient 既为十进制的值 二进制到十六进制: 四个为一组,进行上述行为 0-10 未 0-10,11A12B13C14D15E16F 十进制到二进制: 例子 479 479 / 2 = 239 余 1 239 / 2 = 119 余 1 以此类推 14 / 2 = 7 余 0 7 / 2 = 3 余 1 3 / 2 = 1 余 1 /2 = 1 余 0 所以是 479 =11101111 10 2 Numeric Type: a type of values that represents a number system. 包括 int; long; float; complex Module: Python program that can be used as a unit. [import math] Design patterns: template for solving a general design problem within a particular context. Lecture 4 Sequence: an enumerated 例举 collection of objects in which repartitions are allowed. Sequence type: string, Unicode, list. 包括 operator:len—length; + -- concatenation; * -- repetition; x[i] ith mumber; x[:j] slice from I to j. Character: graphemes (units of a writing system) String: a finite sequence of characters. Ord 将 ascii 化为 numerical Chr 将 numerical code 化为 ascii ***x=[‘a’,’b’,’c’] y=’abc’ 其中 x[0]=y[0] x[1]=y[1]这样,但是 x 的元素可以单独赋值 List: a finite sequence of values List 可以含有不同的种类的元素【0,’’,[]】 并且可根据 assignment 改 >>>X=[‘a’,’b’,’c’] >>>X[2]=’d’ >>>X=[‘a’,’b’,’d’] Alan Turing: British computer scientist, 1937 model of computation; 设计 Automatic Computing Engine electronic computer 1945; 1950 图灵测试 File: a finite sequence of data stored on a persistent data storage device. 若连续读两次,,y 跑出的是空 string Lecture 5 Object: a mutable, active value that combines data and operations and communicates via message passing. Object’s data is a set of variables called fields. Fields 决定了 object 的 state Accessor: 得到 data 的 method Mutator: 改数据的 method Classes: Template of a type of objects. *__init__ Object oriented programming language. Graphics 里的 sample mutator and accessors: -getHeight() setBackground() **python 里面,x+y==y+x 是 false 的,append 的顺序不一样 Donald Knuth: Author of The Art of Computer Programming in 1968 Lecture 6 Function is a relation between a set of inputs and a set of outputs such that each input is related to exactly one output. Partial function: 仅适用于部分 domain Function: represents a mathematical function as a value that can be applied as a rule. -def FunctionName(p1,p2,p3,p4) P 为 formal parameters of the function definition 1. P are the inputs 2. When the functions is called they become the local variables of the function call. 可以 print 但是最好 return value ** return none = 什么都不出来 Lecture 7 Boolean: a standard truth value, either true or false. Conditional statements: select a statement for execution on the basis of whether a condition represented as a Boolean expression evaluate to true or false. 包括 if; if else; if else elif; try except; while *try [[[[[]]]]] except[[[[]]]] 试试看[[[[[]]]]]的方法,若是碰上[[[[[[]]]]则采取某种措施 Lectur
More Less

Related notes for ENGINEER 1D04

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.