1. Charming Python
An introductory session on the Python
programming language!
2. Python: A quick look!
Python is a programming language that lets you work more
quickly and integrate your systems more effectively. You can
learn to use Python and see almost immediate gains in
productivity and lower maintenance costs.
General Purpose
High Level
Interpreted
Multi paradigm programming
Fully dynamic typing
Cross Platform
CPython, Jython, IronPython (CPython != Cython)
3. Who uses Python?
Google, NASA, Facebook ,
Yahoo!, Microsoft, Oracle,
Nokia, Reddit, Canonical, Walt
Disney, Astra Zeneca,
Lucasfilm
All the cool kids are using Python!
4. Enough Talks!
Installing and running python codes
*nix and *nix alike system users - sit back and relax!
Windows Users:
✤ Go to Python.org
✤ Get the Python 2 installer
✤ Install it yourself
✤ Add python to your system path
5. Show me the codes!
Let’s say hello to the big snake!
print "hello python!"
How about a function?
def say_hello(name):
print "Hello " + name + "!"
say_hello("python")
6. Let there be Objects!
class TheGreeter:
! def __init__(self, name):
! ! self.name = name
! def greet(self):
! ! print "Hello " + self.name + "!"
greeter = TheGreeter("Python")
greeter.greet()
8. Lists!
id_list = [1,2,3,4,5,6,7,8,9,10]
# Indexing
print id_list[1]
# Add to list
id_list.append(11)
print id_list
# Remove from list
id_list.remove(11)
print id_list
# Slicing
new_list = id_list[0:2]
print new_list
# List Comprehension
another_list = [x for x in id_list if x > 5]
print another_list
# All those squares!
print [x**2 for x in id_list]
10. Conditions and For Loop
In the case of the unforgivable curses!
spell_list= ["Crucio!", "Avada Kedavra!","Imperio!",
"Expelliarmus!"]
for spell in spell_list:
if spell == "Avada Kedavra!":
! print "You're dead already!"
elif spell == "Imperio!":
! print "You lost control of your mind!"
elif spell == "Crucio!":
! print "I can feel your agony!"
else:
! print "No unforgivable curses were cast upon you!"
17. PyCharmers & Me!
PyCharmers: http://pycharmers.net .
Previously known as “Python Bangladesh”, a
platform for Bangladeshi Python developers
to share and collaborate!
Abu Ashraf Masnun
http://masnun.me | masnun@pycharmers.net | @masnun
Business student, software gardener and open source
enthusiast!