Introduction to Programming with Python
Riding the Serpent Anshul Nigham & Rob Tirrell April 16, 2011
1 / 1
Introduction to Programming with Python Riding the Serpent Anshul - - PowerPoint PPT Presentation
Introduction to Programming with Python Riding the Serpent Anshul Nigham & Rob Tirrell April 16, 2011 1 / 1 About Us Anshul Nigham Began programming at 12 on on 8086 PC-XT (a full-fledged computer 20x slower than an iPhone). Converts
1 / 1
2 / 1
3 / 1
4 / 1
5 / 1
6 / 1
7 / 1
8 / 1
9 / 1
10 / 1
11 / 1
12 / 1
13 / 1
14 / 1
15 / 1
16 / 1
17 / 1
1
2
3
18 / 1
1Baseball is a popular American sport. Rob’s hometown is the supposed ’birthplace
2The deliberate application of statistics to baseball is known as ’sabremetrics’.
19 / 1
20 / 1
21 / 1
1
1
2
3
3The divisor – at bats – needs to be a floating-point number, so enter it as 458.0,
22 / 1
23 / 1
24 / 1
1
2
3
4
5
6
7
8
9
25 / 1
4There is a difference: methods are attached to and operate on their objects, while
26 / 1
27 / 1
1
2
3
28 / 1
1
2
3
4
5
5The ’\’ just allows us to continue an expression on the next line, so it doesn’t run
29 / 1
1
2
3
4
1
2
3
30 / 1
1
2
3
4
5
6
7
1
2
3
31 / 1
1
2
3 4
5
6
7 8
9
10
11
12 13
32 / 1
1
2
3
4
5
6
7
8
6Functions versus methods: say hello is an example of a method, it’s
33 / 1
1
2
3
4
5
34 / 1
1
2
3
4
5
6
7
8
9
35 / 1
36 / 1
1
2
1
37 / 1
7BMI’s utility as a measure of health is somewhat limited – it does not necessarily
38 / 1
1
2
3
4
39 / 1
40 / 1
1
2
3
4
5
6
7
8
41 / 1
1
2
1
2
42 / 1
1
2
3
4
5
43 / 1
1
2
3
4
44 / 1
8Actually, we can also omit 0, randrange or randint with one argument are
45 / 1
1
2
3
4
5
46 / 1
9The internals of the file are omitted from discussion today. They’re slightly more
47 / 1
1
2
3
4
5
6
7
8
48 / 1
49 / 1
1
2
3
50 / 1
1
2
3
4
5
6
1
2
3
4
5
6
7
8
51 / 1
1
2
3
4
52 / 1
10Kind of like Perl :).
53 / 1
11Reminder:
54 / 1
55 / 1
56 / 1
57 / 1
Image credit: O’Reilly (http://oreilly.com/news/graphics/prog lang poster.pdf) 58 / 1
59 / 1