1 / 12

Introduction to Python: Slides Referenced in Homework 0

Introduction to Python: Slides Referenced in Homework 0. CSE-391: Artificial Intelligence University of Pennsylvania Matt Huenerfauth January 2005. What is Python?. A programming language with strong similarities to PERL, but with powerful typing and object oriented features.

creda
Download Presentation

Introduction to Python: Slides Referenced in Homework 0

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. Introduction to Python:Slides Referenced in Homework 0 CSE-391: Artificial IntelligenceUniversity of Pennsylvania Matt Huenerfauth January 2005

  2. What is Python? • A programming language with strong similarities to PERL, but with powerful typing and object oriented features. • Commonly used for producing HTML content on websites. Great for text files. • Useful built-in types (lists, dictionaries). • Clean syntax, powerful extensions.

  3. Why Python for CSE-391? • Textbook Code: Very Object Oriented • Python much less verbose than Java • AI Processing: Symbolic • Python’s built-in datatypes for strings, lists, and more. • Java or C++ require the use of special classes for this. • AI Processing: Statistical • Python has strong numeric processing capabilities: matrix operations, etc. • Suitable for probability and machine learning code.

  4. Before we get started…

  5. Homework 0: Learning Python • Unfortunately, we won’t have time to cover all of Python in class; so, we’re just going to go over the highlights. • You’ll need to learn more on your own. • Homework 0 asks you to install Python or get comfortable using it on Eniac. It also asks you to read some online Python tutorials. • Later homeworks will include Python programming exercises to help you practice.

  6. Homework 0: Python Tutorials You should definitely read these… • “Dive into Python” (Chapters 2 to 4)http://diveintopython.org/ • Python 101 – Beginning Pythonhttp://www.rexx.com/~dkuhlman/python_101/python_101.html You should browse these and refer to them… • The Official Python Tutorialhttp://www.python.org/doc/current/tut/tut.html • The Python Quick Reference http://rgruet.free.fr/PQR2.3.html

  7. Homework 0: Official Handout • There’s an official handout for Homework 0 (available on the class website) that describes the assignment in more detail. • There is some Python code to submit. • There are some questions to answer about the readings.

  8. Technical Issues

  9. Installing Python • Python is on eniac: /pkg/bin/python • Python for Win/Mac from www.python.org. • GUI development environment: IDLE. Credits:http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html

  10. IDLE Development Environment • Shell for interactive evaluation. • Text editor with color-coding and smart indenting for creating python files. • Menu commands for changing system settings and running files. • You’ll see me using IDLE in class.

  11. Running Interactively on UNIX On Unix… % python >>> 3+3 6 The ‘>>>’ is the Python prompt. In Unix, when finished, you can use CONTROL+D.

  12. Running Programs on UNIX %python filename.py You can create python files using emacs. (There’s a special Python editing mode.) You could even make the *.py file executable and add the following text to top of the file to make it runable: #!/pkg/bin/python

More Related