Play with python lecture 1
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Play with python lecture 1

on

  • 1,161 views

 

Statistics

Views

Total Views
1,161
Views on SlideShare
1,161
Embed Views
0

Actions

Likes
0
Downloads
43
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Play with python lecture 1 Presentation Transcript

  • 1. ‫‪Play with Python‬‬ ‫‪Orientation Session‬‬‫كل الكتب والمراجع و البرامج موجودة على أجهزة معامل الكلية :ملحوظة‬ ‫/‪www.python.org‬‬
  • 2. Agenda• Why?• Interpreted vs Compiled languages• Dynamically typed vs Static typed languages• A Quick Tour of Python• Course Structure• Environment and Software Guido van Rossum
  • 3. Why?Easy, Productive, ExtensibleYoutube: :"Python is fast enough for our site and allows us to produce maintainable features in record times, with a minimum of developers" "NASA code policy is to implement everything in Python, and leave performance critical pieces of code to C++"Peter Norvig (AI Computer Scientist, Director of Search Quality at Google, recommends Python for his AI Class): "Today dozens of Google engineers use Python, and were looking for more people with skills in this language."
  • 4. Why?Easy, Productive, ExtensibleEVE Online : "Python enabled us to create EVE Online, a massive multiplayergame, in record time. The EVE Online server cluster runs over 50,000simultaneous players in a shared space simulation, most of which is created inPython"stackoverflow.com user: “If you are a programmer charging by the hour, you SHOULD NOT use Python, because it ensures you wont be able to charge your customer much” Mark Lutz (Python Books Author): "Today, I can safely say that Python has changed my life. I have moved to a different continent."
  • 5. Why?Who uses Python ?: Watch this Google I/O video clip, Wesley Chun listing the uses of python and what companies use Python. (from 22:35 to 29:10 )
  • 6. Why?Who uses Python ?: Google NASA Yahoo Youtube Watch this Google I/O video clip, Wesley Chun listing the uses of python and what Linux (RedHat, Ubuntu, ...) companies use Python. (from 22:35 to 29:10 ) Lots of researchers EVE online (Thousands of online players) MIT (Programming Intro. Course) etc...
  • 7. Awards !Why?Who uses Python ?: Google NASA Yahoo Youtube Watch this Google I/O video clip, Wesley Chun listing the uses of python and what Linux (RedHat, Ubuntu, ...) companies use Python. (from 22:35 to 29:10 ) Lots of researchers EVE online (Thousands of online players) MIT (Programming Intro. Course) etc...
  • 8. Awards !Why?Who uses Python ?: Google NASA Yahoo Youtube is Open Source, free, even for commercial use ! Watch this Google I/O video clip, Wesley Chun listing the uses of python and what Linux (RedHat, Ubuntu, ...) companies use Python. (from 22:35 to 29:10 ) Lots of researchers EVE online (Thousands of online players) MIT (Programming Intro. Course) etc...
  • 9. Why?Python Software Foundation (PSF), the organization that is devoted to advancepython, has these prestigious members(and many other companies and organizations ....)
  • 10. Why?Python is mainly used in: • Rapid Prototyping and Experimenting • Scripting • Text Processing • Web applications • Game Development • System Administrations • Fun Stuff that need quick experiments: o like robotics or any scientific math • Teaching kids programming :)
  • 11. Interpreted vs Compiled languages• Python, Javascript and many other languages are "Interpreted" languages o which means there is no compilation phase needed to run the program o instead an interpreter interprets your code directly and executes it o this means that you dont have to wait for long compilation times in big projects• But the down side that is the language is slower than compiled ones like C/C++/C#/Java o Often, productivity and development time is much important than language speed o in some cases you may need special extra speed, here you can implement the time critical pieces in a C++ for example
  • 12. Interpreted vs Compiled languages• The python interpreter (Demo) o one of the great advantages of any interpreted language, the interpreter allows you to instantly execute any piece of code you need to understand or test
  • 13. Interpreted vs Compiled languages• This allows you to do quick experiments and prototypes for your ideas like simple programs or even scientific functions (like matlab, maple, octane ... but with much stronger and easier OOP language)
  • 14. Interpreted vs Compiled languages• This allows you to do quick experiments and prototypes for your ideas like simple programs or even scientific functions (like matlab, maple, octane ... but with much stronger and easier OOP language)
  • 15. This Makes Python Fun !BUT, Python is not a replacement to other languages: A common error some people do, is they tend to put languages in struggle as if there must be only 1 language to learnTHIS is WRONG!Python/Javascript/Lisp are great, C++/C#/Java are great,every language has its role in this world.You can be a Pythonista and a C++er in the same timeAnd you can always mix them together to fit your needs
  • 16. Dynamically typed vs Static typedlanguages• In Java, C#, C/C++, types are explicit: • int n = 7; • String s = “Hi”; • var n = 3;• in Python, Ruby, Javascript, types are dynamic: • n=7 • s = “Hi” • n = "hello"No Static Types
  • 17. A Quick TourA Sample Program: def greetings(name): if name == "": #This is a comment msg = "Hello Guest. Welcome!" else: msg = "Hello " + name + ". Welcome!" return msg====================================>>> greetings("FCIS")‘Hello FCIS. Welcome!’ >>> greetings("") ‘Hello FCIS. Welcome!’
  • 18. A Quick Tour A Sample Program: Function def greetings(name): if name == "": #This is a comment msg = "Hello Guest. Welcome!"Indentation else: msg = "Hello " + name + ". Welcome!" return msg Variable ==================================== >>> greetings("FCIS") ‘Hello FCIS. Welcome!’ >>> greetings("") ‘Hello FCIS. Welcome!’
  • 19. Other Python Aspects• Generators• Map, Zip• Lambdas• List comprehensions• Closures• ...
  • 20. Course Structure• Lecture 1, 2: • Python Language, Object Oriented • Lecture 1: Strings, Numbers, Loops, Functions, List, Tuple, Dictionary • Lecture 2: , importing packages, Sets, Sorting, Classes, Object Oriented, Constructors, Destructors, isinstance• Lecture 3, 4: • Exceptions • More Language Features (Map, Zip, Lambdas, Generators) • Saving and restoring from files • GUI with PyQt4 • Diverse uses of Python: scientific computing with python, graphs, visualizations• Lecture 5, 6: • Web with Django • Game with PyGame
  • 21. Environment and Software• Python language (The Python language) • Version 2.7.3 http://www.python.org/download/• Aptana Studio 3 (our main IDE) : • http://www.aptana.com/products/studio3/download (needs java)• Pythonxy (Scientific Computing): • http://code.google.com/p/pythonxy/• PyGame (Games): • http://www.pygame.org/download.shtml• Django (Web): • https://www.djangoproject.com/download/• All Free !(Note: PySide is deleted, we dont need it, we will work with PyQt4 which isalready included in Pythonxy)Note: If you want to use Python in visual studio 2010 and dont wantto download big downloads like Aptana, you can use Microsoft Official"Python Tools for visual studio" at http://pytools.codeplex.com/,only 4 MB beside python, and you have an excellent full IDE forpython.
  • 22. References (‫)الترتيب حسب األهمية‬This Presentation References: • The Official The Python Tutorial: http://docs.python.org/tutorial/ • Official Python Library Reference: http://docs.python.org/library/ • Official Python Language Reference: http://docs.python.org/reference/ • Pyschools Python Intro: http://www.pyschools.com/downloads/A_Quick_Python_Tour.pdf
  • 23. References (‫)الترتيب حسب األهمية‬General References for the Course: • Beginners: o Concentrated short introductions for the language (directly only to the language and examples, no other talk about anything else except the language, any one of the following is good):  The Official The Python Tutorial (link in previous slide)  A byte of Python, for Python 2.x (A Quick Book): http://www.swaroopch.org/notes/Python  PySchools Python Quick Reference Guide (along with online interactive excercises to solve, very useful): http://doc.pyschools.com/html/index.html, Exercises: http://www.pyschools.com/quiz/view_summary o Online Interactive Tutorials (interactive exercising during reading, very enjoyable)  University of Waterloo online Interactive Python Tutorial: http://cscircles.cemc.uwaterloo.ca/using- this-website/  Online Python Tutor (just excercises, I but it here shows automatic code tracing while exercising): http://people.csail.mit.edu/pgbovine/python/tutor.html#mode=edit  learnpython.orgs interactive Python tutorial: http://www.learnpython.org/ o Beginners Books (not only language and examples, but everything you need to know about Python) (*):  Python for Dummies (2006) (Fast short examples like "A byte of Python")  Core Python Programming (2nd Edition) , Chun (2006) (longer examples and explanation)  Learning Python, Mark Lutz (4th Edition) (For the very detailed explanation of everything about Python, very good if you have time, or want to parachute on specific thing to understand deeply) (*) https://docs.google.com/file/d/0B2Jt9cH9yJtraE1iOGR0X19zNFk/edit
  • 24. THANK YOU