How to python

1,978 views

Published on

Published in: Education
  • Be the first to comment

How to python

  1. 1. How To Python*<br />Medhat dawoud<br />Software Junior Developer<br />medhatdawoud@gmail.com<br />http://med7at.wordpress.com<br />* Program with python<br />October 12,2010<br />1<br />
  2. 2. Python?<br />Father Guido Van Rossum<br />Birth-year <br />1989<br />Born at<br />Amsterdam<br />October 12,2010<br />2<br />
  3. 3. Python’s Father <br />Guido Van Rossum <br />is Netherlands, who write the python programming language as a successor to the ABC programming language, in his week ends , and call it python Relative to the a British television comedy sketch on the BBC…<br />Called “Monty Python's Flying Circus”<br />October 12,2010<br />3<br />
  4. 4. Python?<br />Platform independent<br />Interpreter Language<br />Script Language<br />Supports OOP<br />Object Oriented Programming<br />October 12,2010<br />4<br />
  5. 5. Why Python ?<br /> Easy Syntax<br /> Easy Grammar<br /> Easy Data Structure<br /> Many Packages<br />Very Readable<br />Very Flexible<br />Usually Short Code<br />Easy to Manage Code<br />Easy to Work Together<br />October 12,2010<br />5<br />
  6. 6. Get Python!<br />On Windows<br />http://www.python.org<br />DOWNLOAD<br />Recommended Version 2.5.X <=<br />October 12,2010<br />6<br />
  7. 7. Get Python!<br />On Debian Linux<br /> ~# apt-get install python<br /> ~$ sudo apt-get install python<br />October 12,2010<br />7<br />
  8. 8. Run Python!<br /> ~$ python<br />October 12,2010<br />8<br />
  9. 9. Run Python!<br /> ~# apt-get install ipython<br /> ~# ipython<br />October 12,2010<br />9<br />
  10. 10. Python Syntax<br />Use python as simple calculator<br />>>> 1 + 2<br />>>> 6 * 8<br />>>> 6.0 * 8<br />>>> 2 ^ 10<br />>>> 2 ** 10<br />>>> _ / 2<br />>>> __ / 4<br />>>> _<br />October 12,2010<br />10<br />
  11. 11. Python Syntax<br />Print the “Hello world!”<br />>>> print “Hello World!”<br />>>> print(“Hello World!”)<br />October 12,2010<br />11<br />
  12. 12. Python Syntax<br />Multiline Text<br />Single Quote<br />INDENTATION!!<br />October 12,2010<br />12<br />
  13. 13. Python Syntax<br />Indentation is also Syntax!!!<br />October 12,2010<br />13<br />
  14. 14. Python Syntax<br />You MUST keep the same indentation!<br />October 12,2010<br />14<br />
  15. 15. Python Variables<br />But you don’t have to care!<br />October 12,2010<br />15<br />
  16. 16. Python Variables<br />Dynamic Typing<br />October 12,2010<br />16<br />
  17. 17. Python Controls<br />if<br />for<br />while<br />try, except<br />October 12,2010<br />17<br />
  18. 18. if<br />“a is three”<br />October 12,2010<br />18<br />
  19. 19. for<br />October 12,2010<br />19<br />
  20. 20. While<br />October 12,2010<br />20<br />
  21. 21. Try, Except<br />October 12,2010<br />21<br />
  22. 22. Number<br />7<br />0<br />7.0<br />0.75<br />5+5j<br />October 12,2010<br />22<br />
  23. 23. String<br />October 12,2010<br />23<br />
  24. 24. String<br />October 12,2010<br />24<br />
  25. 25. List, Tuple<br />October 12,2010<br />25<br />
  26. 26. List, Tuple<br />October 12,2010<br />26<br />
  27. 27. Dictionary<br />October 12,2010<br />27<br />
  28. 28. Dictionary<br />October 12,2010<br />28<br />
  29. 29. Dictionary<br />October 12,2010<br />29<br />
  30. 30. Simple input<br />October 12,2010<br />30<br />
  31. 31. Do It Yourself #1<br />Your program should do the following<br /> 1. Calculate the 224<br />2. Save the result to “result”<br /> 3. Print the “result”<br />October 12,2010<br />31<br />
  32. 32. Do It Yourself #2<br />Your program should do the following<br /> 1. Print out the even numbers between 1 to 1000, without line breaks<br /> 2. Print out the 1000 / n When n is between -100 to 100<br />October 12,2010<br />32<br />
  33. 33. Do It Yourself #3<br />Your program should do the following<br /> 1. Let given=“we are so friend!”<br /> 2. Using slicing, concatenating, indexing, and methods, make following result<br /> - “we are friend!”<br /> - “are WE so friend”<br /> - “so friend we are”<br />October 12,2010<br />33<br />
  34. 34. Do It Yourself #4<br />Your program should do the following<br /> 1. Let given=range(100)<br /> 2. Using the given, get the following<br /> - Even number between 0~99<br /> - Odd number between 0~99<br /> - Multiplier of 3 between 0~50, 70~99<br /> - List starts from 99 and ends at 1<br />October 12,2010<br />34<br />
  35. 35. Do It Yourself #5<br />Your program should do the following<br /> 1. Get the input Name and Age<br /> 2. Save the Name and Age to dictionary<br /> 3. If input is empty Change the input mode to search4. On search mode Print the age of given name<br />October 12,2010<br />35<br />
  36. 36. Summary<br />Now you know…<br /> How to Install and Run Python<br /> How to Use Python as Calculator<br /> Basic Python Syntax <br />(indentation, quote, multiline text…)<br /> Python Data Structure <br />(string, number, list, dictionary, tuple…)<br /> Basic Input, Output to the terminal<br />(input, raw_input, print)<br />October 12,2010<br />36<br />
  37. 37. You have just learned <br /> of python!<br />October 12,2010<br />37<br />50%<br />
  38. 38. Warning:Sorry to say that You Still CanNot<br />Program with Python Under Linux.<br />Treating with files.<br />Dealing with Modules and functions.<br />Connect to a database .<br />Treat with XML throw Python.<br />Make Interaction GUI Applications.<br />Make a Networking Applications.<br />Making a Web Applications.<br />October 12,2010<br />38<br />
  39. 39. October 12,2010<br />39<br />All these Contents Will be Covered in Details in The Full Course<br />ISA<br />If you wish .. Contact customer services<br /><br />
  40. 40. October 12,2010<br />40<br />The End<br />
  41. 41. October 12,2010<br />41<br />Thanks<br />

×