SlideShare a Scribd company logo
1 of 19
Charming Python
 An introductory session on the Python
        programming language!
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)
Who uses Python?
  Google, NASA, Facebook ,
  Yahoo!, Microsoft, Oracle,
Nokia, Reddit, Canonical, Walt
    Disney, Astra Zeneca,
          Lucasfilm

 All the cool kids are using Python!
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
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")
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()
Python Comments!
"""class TheGreeter:
! def __init__(self, name):
! ! self.name = name


! def greet(self):
! ! print "Hello " + self.name + "!"


"""

greeter = TheGreeter("Python")
#greeter.__init__("masnun")
greeter.greet()
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]
Introspection at it’s best!
    using dir(), help() and pydoc
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!"
While Loop
while True:
! print "You're in an infinite loop!"
Using Modules
import math
print math.factorial(999)
Writing Modules
                    lib.py
           def say_hello():
           ! print "Hello Python!"


                  greet.py
          import lib
          lib.say_hello()


And yes, pydoc works on custom modules!
The Python Arsenal!
Notable frameworks, modules and tools!
❖ Django
❖ wxWidgets
❖ PyQT / PySide
❖ Numpy
❖ Celery
❖ Google App Engine
❖ BeautifulSoup
❖ Shovel
❖ Python for Android
❖ Kivy
The Zen of Python

   import this
import antigravity
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!
Slides & Codes
Slides: http://www.masnun.me/talks

Codes: https://github.com/masnun/openday-khulna
Queries?

More Related Content

Similar to Charming python

The Python Book_ The ultimate guide to coding with Python ( PDFDrive ).pdf
The Python Book_ The ultimate guide to coding with Python ( PDFDrive ).pdfThe Python Book_ The ultimate guide to coding with Python ( PDFDrive ).pdf
The Python Book_ The ultimate guide to coding with Python ( PDFDrive ).pdfssuser8b3cdd
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPTShivam Gupta
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdfgmadhu8
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxlemonchoos
 
Learn Python 3 for absolute beginners
Learn Python 3 for absolute beginnersLearn Python 3 for absolute beginners
Learn Python 3 for absolute beginnersKingsleyAmankwa
 
Python in 30 minutes!
Python in 30 minutes!Python in 30 minutes!
Python in 30 minutes!Fariz Darari
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptxArpittripathi45
 
Class 1: Welcome to programming
Class 1: Welcome to programmingClass 1: Welcome to programming
Class 1: Welcome to programmingMarc Gouw
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughgabriellekuruvilla
 
Python basics_ part1
Python basics_ part1Python basics_ part1
Python basics_ part1Elaf A.Saeed
 

Similar to Charming python (20)

The Python Book_ The ultimate guide to coding with Python ( PDFDrive ).pdf
The Python Book_ The ultimate guide to coding with Python ( PDFDrive ).pdfThe Python Book_ The ultimate guide to coding with Python ( PDFDrive ).pdf
The Python Book_ The ultimate guide to coding with Python ( PDFDrive ).pdf
 
Python
PythonPython
Python
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdf
 
05 python.pdf
05 python.pdf05 python.pdf
05 python.pdf
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
 
python into.pptx
python into.pptxpython into.pptx
python into.pptx
 
Learn Python 3 for absolute beginners
Learn Python 3 for absolute beginnersLearn Python 3 for absolute beginners
Learn Python 3 for absolute beginners
 
Python in 30 minutes!
Python in 30 minutes!Python in 30 minutes!
Python in 30 minutes!
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
 
Class 1: Welcome to programming
Class 1: Welcome to programmingClass 1: Welcome to programming
Class 1: Welcome to programming
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Intro
IntroIntro
Intro
 
Python: The Dynamic!
Python: The Dynamic!Python: The Dynamic!
Python: The Dynamic!
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python fundamentals
Python fundamentalsPython fundamentals
Python fundamentals
 
Report om 3
Report om 3Report om 3
Report om 3
 
Python basics_ part1
Python basics_ part1Python basics_ part1
Python basics_ part1
 

Recently uploaded

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 

Recently uploaded (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Charming python

  • 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()
  • 7. Python Comments! """class TheGreeter: ! def __init__(self, name): ! ! self.name = name ! def greet(self): ! ! print "Hello " + self.name + "!" """ greeter = TheGreeter("Python") #greeter.__init__("masnun") 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]
  • 9. Introspection at it’s best! using dir(), help() and pydoc
  • 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!"
  • 11. While Loop while True: ! print "You're in an infinite loop!"
  • 12. Using Modules import math print math.factorial(999)
  • 13. Writing Modules lib.py def say_hello(): ! print "Hello Python!" greet.py import lib lib.say_hello() And yes, pydoc works on custom modules!
  • 14. The Python Arsenal! Notable frameworks, modules and tools! ❖ Django ❖ wxWidgets ❖ PyQT / PySide ❖ Numpy ❖ Celery ❖ Google App Engine ❖ BeautifulSoup ❖ Shovel ❖ Python for Android ❖ Kivy
  • 15. The Zen of Python import this
  • 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!
  • 18. Slides & Codes Slides: http://www.masnun.me/talks Codes: https://github.com/masnun/openday-khulna

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n