Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to Python

3,524 views

Published on

Published in: Technology, Education
  • The essay is the most important part of a college application, so you need to focus and make a good essay to convince the university accept you. You even get help from essay writing expert to ensure you acceptance. Check out, please HelpWriting.net
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating direct: ❤❤❤ http://bit.ly/2Qu6Caa ❤❤❤
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating for everyone is here: ❤❤❤ http://bit.ly/2Qu6Caa ❤❤❤
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Introduction to Python

  1. 1. Python Session 1: introduction to Python José Dapena Paz <jdapena@igalia.com>
  2. 2. Sessions ● Session 1: – Presentation of language, brief history and practical examples of language structures. ● Session 2: – Important projects – Standard libraries – Other modules
  3. 3. First session contents ● ¿What's Python? – Brief history – Properties – Documentation ¿Where? ● Introduction to the language – Installation and usage – Practical examples
  4. 4. ¿What's Python? ● ¿What's Python? – Brief history – Properties – Documentation ¿Where? ● Introduction to the language – Installation and usage – Practical examples
  5. 5. ¿What's Python? ● High level language ● Author: Guido Van Rossum (first release in 1991) ● Emphasis on readability. ● Priority: easy for programmer, then, computer. ● Minimalist language. Wide libraries.
  6. 6. History ● Author: Guido Van Rossum. CWI. ● Begins Python at the end of 80's. Inspired in ABC language. ● First release in 1991. ● Guido Van Rossum: Benevolent Dictator For Life
  7. 7. Cronology ● 1991: 1st release. Classes, inheritance, exceptions, modules and basic types list, dict y str ● 1994: 1.0. Basic functional programming (lambda methods). ● 2001: 1.6.1 y 2.1. GPL compatible license. ● Python 2.2. All types are unified. All are classes. ● Futurr: Python 3000 (3.0) in 2008.
  8. 8. Python is free software ● From Python 2.2, Python Foundation Software License, GPL-compatible. ● All code is property of Python Foundation. ● Python community show a very high activity: – Hundreds of modules/extensions available. – Lots of software available implemented in Python. – Python is the language of 2007 (language TIOBE, Python had biggest increase of usage).
  9. 9. Documentation ● Python is very well documented http://docs.python.org ● Tutorial: http://docs.python.org/tut/ ● Language reference: (for language lawyers): http://docs.python.org/ref/ ● Library reference: http://docs.python.org/lib/
  10. 10. First session contents ● ¿What's Python? – Brief history – Properties – Documentation ¿Where? ● Introduction to the language – Installation and usage – Practical examples
  11. 11. Installation and running In ubuntu, install Python package: $ sudo apt-get install python Very useful to install online documentation: $ sudo apt-get install python-doc
  12. 12. Python shell ● Python is an interpreted language. ● Modes: – Interactive – File – Command line – Executable
  13. 13. Modo interactivo Just run Python, and add commands and statements in the shell $ python Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type quot;helpquot;, quot;copyrightquot;, quot;creditsquot; or quot;licensequot; for more information. >>> 1+1 2 >>> a = ”hola” >>> a 'hola' >>> print a hola
  14. 14. Shell mode help Whith dir () command we get the methods available. >>> dir (a) # With instances >>> dir (list) # With classes With help () command we get the help of a class or instance. >>> help (a) # With instances (no strings) >>> help (list) # With classes
  15. 15. Python as a calculator ● Basic types: – Integers – Floats and complex numbers – Strings ● Asign ● _ variable ● Lists. Ranges, asigns by range, operators.
  16. 16. Control flow structures ● While. Indentation in Python ● If, If-Elif-Else ● For, range. ● Break, continue, else, pass ● Functions. Definition. ● Classes
  17. 17. More flow control structures ● List methods. The list as a queue and as a stack. ● Map, reduce, filter ● List comprehensions ● Del ● Other sequences: tuples. Dictionaries ● Looping ● Conditions, conditions in sequences.
  18. 18. Modules ● Modules reference ● Examples: Files api (File objects), http api (urllib2)

×