Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
LING 408/508: Programming for Linguists Lecture 20 November 16th Administrivia • Quickie Homework 10 – Python • Term Programming Project – Did you email me about your proposed project yet? Online documentation Python • Chapter 3: Computing with Numbers • Last time: – Number data types: int, float – Matters for things like division: / • 9/5 produces different result from 9/5.0 Basic: Library: module Python • math.sqrt() complex numbers: import cmath Python • range(): produces a list (sequence) – range(n) [0,1,..,n-1] – range(start,n) [start,start+1,..,n-1] – range(start,n,step) [start,start+step,…,last] – last=start+k*step < n – range(n,stop,-step) counts down (page 40) Python How about to 2 decimal places? Python • page 60: see factorial.py – Python automatically converts to type long int from int (32 bit 2's complement), (page 64–65, section 3.5) – explicit type coercion: 1. 2. 3. 4. 5. float() int() long() complex(r,i) complex(string) Homework 10 • Pick any three of the programming exercises from page 72-75 – Program them up in python – Submit your code and sample runs all in one pdf file – Due this Saturday by midnight