Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Python: Slides Referenced in Homework 0 CSE-391: Artificial Intelligence University of Pennsylvania Matt Huenerfauth January 2005.

Similar presentations


Presentation on theme: "Introduction to Python: Slides Referenced in Homework 0 CSE-391: Artificial Intelligence University of Pennsylvania Matt Huenerfauth January 2005."— Presentation transcript:

1 Introduction to Python: Slides Referenced in Homework 0 CSE-391: Artificial Intelligence University 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/ http://diveintopython.org/ Python 101 – Beginning Python http://www.rexx.com/~dkuhlman/python_101/python_101.html http://www.rexx.com/~dkuhlman/python_101/python_101.html You should browse these and refer to them… The Official Python Tutorial http://www.python.org/doc/current/tut/tut.html http://www.python.org/doc/current/tut/tut.html The Python Quick Reference http://rgruet.free.fr/PQR2.3.html 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


Download ppt "Introduction to Python: Slides Referenced in Homework 0 CSE-391: Artificial Intelligence University of Pennsylvania Matt Huenerfauth January 2005."

Similar presentations


Ads by Google