1 / 22

Overview of Python

Overview of Python. Professor Frank J. Rinaldo Creation Core - office 401. Python. Textbook Python Programming for the Absolute Beginner (second edition) By Michael Dawson Premier Books 2008 ISBN: 1-59863-112-8. Introducing Python. Easy to Use Powerful Object-Oriented

selina
Download Presentation

Overview of Python

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Overview of Python Professor Frank J. Rinaldo Creation Core - office 401

  2. Python • Textbook • Python Programming for the Absolute Beginner (second edition) • By Michael Dawson • Premier Books • 2008 • ISBN: 1-59863-112-8

  3. Introducing Python • Easy to Use • Powerful • Object-Oriented • “Glue” language • Run Everywhere • Strong Community • Free & Open Source

  4. PythonEasy to Use • Easier to use than Java, C, C++ • Simple and Clear • Easier user interface • Programs are short • 3 to 5 times shorter than Java • 5 to 10 times shorter than C++

  5. PythonPowerful • Powerful programming language • Used at many major companies • Google • IBM • Microsoft • NASA • Industrial Light + Magic • Used by professional Game Programmers • Activision • Electronics Arts • Infogrames

  6. PythonObject-Oriented • Fully Object-Oriented • Unlike C#, and Java, OOP is optional • Short programs need not be OO • Larger programs can be OO • Very flexible

  7. Python“Glue” Language • Can be integrated with other languages • Extensible • Can be extended • Use subroutines / functions in other languages • Embeddable • Can be used within other languages • i.e. C++ can call Python functions

  8. PythonRun Everywhere • Runs on Palm computers to PC’s to supercomputers • Runs on: • Windows • DOS • Macintosh • Unix / Linux • Programs are platform independent • Programs will run on any computer

  9. PythonStrong Community • Large user group • Large support group • Open Source

  10. PythonFree • Python is Open Source • Python is Free • Python is modifiable

  11. Python Code • Python code is VERY similar to C/C++ and Java • VERY easy to learn • Reviewing Chapter 2 & 3 of textbook

  12. Python Language • All Python code is on CD-ROM • Python web pages: • http://www.python.org/ • http://www.python.org/doc/ • http://www.python.org/doc/nonenglish/ • http://www.python.org/about/gettingstarted/ • Pygame – Python Games web pages: • http://www.pygame.org/news.html • http://www.pygame.org/docs/ • http://www.pygame.org/wiki/tutorials

  13. Python Internet Resources • Beginners Information • http://wiki.python.org/moin/BeginnersGuide/Programmers • Free On-line Book – “Dive into Python” • http://diveintopython.org/ • Several Python books in Japanese • http://wiki.python.org/moin/Languages/Japanese?highlight=%28CategoryLanguage%29

  14. Python IDLE • Integrated Development Environment • Python Editor • Helps debugging • Write, modify & save Python programs

  15. Sample Program 1 print “Game Over” • Simple print statement • Python IS case sensitive!!

  16. Sample Program 2 # Sum # Demo sum program # Frank Rinaldo inp = 1 sum = 0 num = 0 while int(inp) >= 0: inp = raw_input("\n\nPress a number >= 0: ") if int(inp) >= 0: sum = sum + int(inp) num = num + 1 print "The sum of ", num, " numbers is:", sum raw_input("\n\nPress the Enter key to exit.")

  17. Output • Print Statement print “This is a print statement\n”

  18. Input • Input Statement raw_input(“\nPress ENTER key to exit.”)

  19. While loop • While statement sum = 0 x = 10 while x >= 0: sum = sum +x x = x – 1 • NOTE: NO ‘;’ at end of line NO ‘{‘ or ‘}’ INDENTATION used for ‘blocks’ of code

  20. If • If statement if y < 100: y = y + 1 else: print “y is >= 100 ”,y • NOTE: use of ‘:’ & NO ‘{‘ or ‘}’

  21. Notes • NO ‘;’ to end a statement • NO ‘{‘ or ‘}’ for blocks of code • Use indentation to indicate a block of code • Comment Statements start with a ‘#’

  22. HOMEWORKDUE NEXT WEEK! • Write a PYTHON program to: • Find average of positive numbers • Ignore negative numbers • Stop when input is a 0 [zero] • OUTPUT sum, number of numbers, and average

More Related