Python
Python
History
What is Python?
High level, dynamic type, interpreted
programming language.
Commonly used for producing HTML content
on websites.
Useful built-in types (lists, dictionaries).
Clean syntax, powerful extensions.
Why Python?
Applications
Why Python?
Friendly & Easy to Learn
The community hosts conferences and
meetups, collaborates on code, and much
more. Python's documentation will help
you along the way, and the mailing lists
will keep you in touch.
Python.PH is a non-profit organization
Why Python?
Open-source
Python is developed under open source
license, making it freely usable and
distributable, even for commercial use.
Python's license is administered by
the Python Software Foundation.
Installing Python
Python for Win/Mac/Unix/Linux is available
from www.python.org.
Generally an easy install.
On macs, already part of OS X.
Credits:
http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html
Python Interface
Basic Datatypes
Integers (default for numbers)
z=5/2
Floats
x = 3.456
Strings
Can use or to specify. abc abc (Same thing.)
Unmatched ones can occur within the string. matts
Use triple double-quotes for multi-line strings or strings
than contain both and inside of them: abc
Whitespace
Whitespace is meaningful in Python: especially
indentation and placement of newlines.
Use a newline to end a line of code.
(Not a semicolon like in C++ or Java.)
(Use \ when must go to next line prematurely.)
No braces { } to mark blocks of code in Python
Use consistent indentation instead. The first line with
a new indentation is considered outside of the block.
Often a colon appears at the start of a new block.
(Well see this later for function and class definitions.)
Comments
Start comments with # the rest of line is
ignored.
Can include a documentation string as the first
line of any new function or class that you define.
The development environment, debugger, and
other tools use it: its good style to include one.
def my_function(x, y):
This is the docstring. This
function does blah blah blah.
# The code would go here...
Dynamic Typing
Strong Typing
String Operations
We can use some methods built-in to the string
data type to perform some formatting operations
on strings:
>>> hello.upper()
HELLO
(abc, 34)
End of Presentation
Thank You
Take Aways
Practice makes perfect.
Never quit, it is okay to take a rest for a
while.
Make it your daily habit, code,code,code.
Be inspire of small achivements, be
passionate on working something.