Zen and The Art of Python
Zen and The Art of Python
Zen and The Art of Python
Art of Python
The Zen Of
Python
The Zen of
Python
Problem
Problem
Surajkumar Harikumar
Tejasvin Srinivasan
Abdeali Kothari
Pragathi Praveena
Shahidh Muhammed
The WebOps Club
IIT Madras
26 August 2014
1/32
Outline
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
1 Basics
Background
Basic Syntax
Functions, Classes
Imports, Miscellany
The Zen of
Python
Problem
Problem
Problem
2/32
Outline
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
1 Basics
Background
Basic Syntax
Functions, Classes
Imports, Miscellany
The Zen of
Python
Problem
Problem
Problem
3/32
What is Python
The Zen and
Art of Python
The Zen Of
Python
The Zen of
Python
Interpreted
Object-Oriented
Versatile (owing to libraries and packages)
Focuses on easy-to-read code
Easy to learn, Fun to use
Problem
Problem
Quotable
Always code as if the guy who ends up maintaining your code
will be a violent psychopath who knows where you live. Martin Golding
4/32
Why Python
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
5/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Google
DropBox
GIMP
NASA
Problem
CIA
NASA
https://wiki.python.org/moin/OrganizationsUsingPython
http://en.wikipedia.org/wiki/List of Python software
6/32
Outline
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
1 Basics
Background
Basic Syntax
Functions, Classes
Imports, Miscellany
The Zen of
Python
Problem
Problem
Problem
7/32
Hello World
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
8/32
Syntax
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
Comments
Variables and Types:
Integers / Floats
Strings
List / Tuple
Dictionary
Boolean
9/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Arithmetic
String Operations
AND / OR / NOT
Comparing variables
Problem
10/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
11/32
Outline
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
1 Basics
Background
Basic Syntax
Functions, Classes
Imports, Miscellany
The Zen of
Python
Problem
Problem
Problem
12/32
Functions
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
Defining Functions
Function Arguments
args,kwargs
Example
13/32
Classes
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
14/32
Outline
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
1 Basics
Background
Basic Syntax
Functions, Classes
Imports, Miscellany
The Zen of
Python
Problem
Problem
Problem
15/32
Imports, Miscellany
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
Try-except
Documentation
16/32
Outline
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
1 Basics
Background
Basic Syntax
Functions, Classes
Imports, Miscellany
The Zen of
Python
Problem
Problem
Problem
17/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
19/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
19/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
20/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Boolean Type
Reads like English
No unnecessary iterators / variables
Problem
Problem
20/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
21/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Print statements
Interactive Interpreter
Problem
Problem
21/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
22/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
22/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
23/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
23/32
Readability counts.
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
24/32
Readability counts.
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Indentation
PEP8 Standard
Problem
Problem
24/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
25/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
Everything is an object
The Zen of
Python
Problem
Problem
25/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
26/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
OOP
Functional Programming
Problem
Problem
26/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
27/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Exception Handling
Debugging
Problem
Problem
27/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
28/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
Try-Except
The Zen of
Python
Problem
Problem
28/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
29/32
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Problem
Problem
Outline
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
1 Basics
Background
Basic Syntax
Functions, Classes
Imports, Miscellany
The Zen of
Python
Problem
Problem
Problem
31/32
Relative Grading
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
The Zen of
Python
Can you write a function which, given the mark distribution for
the class, computes the mean + standard deviation, and tells
you your grade ?
Problem
Problem
32/32
Wrap Up
The Zen and
Art of Python
Basics
Background
Basic Syntax
Functions,
Classes
Imports,
Miscellany
The Zen Of
Python
Questions ?
The Zen of
Python
Problem
Problem
33/32