Download presentation
Presentation is loading. Please wait.
Published byDina Ashlyn Heath Modified over 9 years ago
1
LING 408/508: Programming for Linguists Lecture 19 November 4 th
2
Administrivia Homework 5 – Does your BMI webserver program work? Homework 6 out today
3
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
4
Python math.sqrt() complex numbers: import cmath
5
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
6
Python page 60: factorial.py – automatically converts to type long from int (32 bit 2's complement) – explicit type coercion: 1.float() 2.int() 3.long() 4.complex(r,i) 5.complex(string)
7
Homework 6 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 next Monday by midnight
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.