background preloader

Python Tutorials

Facebook Twitter

Computer Science Circles | 01000011 01010011 01000011. Instant Python. This is a minimal crash-course in the programming language Python. To learn more, take a look at the documentation at the Python web site,; especially the tutorial. If you wonder why you should be interested, check out the comparison page where Python is compared to other languages. This introduction has been translated into several languages, among them Portuguese, Italian, Spanish, Russian, French, Lithuanian, Japanese, German and Greek, and is currently being translated into Norwegian, Polish, and Korean.

Since this document still might undergo changes, these translations may not always be up to date. Note: To get the examples working properly, write the programs in a text file and then run that with the interpreter; do not try to run them directly in the interactive interpreter - not all of them will work. (Please do not ask me for details on this! To begin with, think of Python as pseudo-code. X,y,z = 1,2,3 first, second = second, first a = b = 123 Simple, isn’t it? #! Python Bibliotheca. S Python Class - Google's Python Class - Google Code. Welcome to Google's Python Class -- this is a free class for people with a little bit of programming experience who want to learn Python. The class includes written materials, lecture videos, and lots of code exercises to practice Python coding. These materials are used within Google to introduce Python to people who have just a little programming experience.

The first exercises work on basic Python concepts like strings and lists, building up to the later exercises which are full programs dealing with text files, processes, and http connections. The class is geared for people who have a little bit of programming experience in some language, enough to know what a "variable" or "if statement" is. Beyond that, you do not need to be an expert programmer to use this material.

This material was created by Nick Parlante working in the engEDU group at Google. Special thanks for the help from my Google colleagues John Cox, Steve Glassman, Piotr Kaminksi, and Antoine Picard. Python for Fun. This collection is a presentation of several small Python programs. They are aimed at intermediate programmers; people who have studied Python and are fairly comfortable with basic recursion and object oriented techniques. Each program is very short, never more than a couple of pages and accompanied with a write-up. I have found Python to be an excellent language to express algorithms clearly. Some of the ideas here originated in other programs in other languages. But in most cases I developed code from scratch from just an outline of an idea.

However Lisp in Python was almost a translation exercise from John McCarthy's original Evalquote in Lisp. From many years of programming these are some of my favorite programs. Many thanks to Paul Carduner and Jeff Elkner for their work on this page, especially for Paul's graphic of Psyltherin (apologies to Harry Potter) and to the teams behind reStructured text and Sphinx to which the web pages in this collection have been adapted. Chris Meyers. Python Tutorial. BeginnersGuide/Programmers. Please Note Because this is a Wiki page, users can edit it. You are therefore free to add details of material that other Python users will find useful. It is not an advertising page, and is here to serve the whole Python community. Users who continually edit pages to give their own materials (particularly commercial materials) prominence, or spam the listing with multiple entries which point to resources with only slightly altered material, may therefore find their accounts are disabled.

You have been warned. Python for Programmers The tutorials on this page are aimed at people who have previous experience with other programming languages (C, Perl, Lisp, Visual Basic, etc.). Books, Websites, Tutorials (non-interactive) Reviews Learn Python - Best Python Tutorials and Courses Python tutorials & courses recommended by the programming community. Resources Learn Python Step by Step - Start learning python from the basics to pro level and attain proficiency. Interactive Tools and Lessons. Byte of Python.

A Python Book: Beginning Python, Advanced Python, and Python Exercises. 2.2 Regular Expressions For more help on regular expressions, see: 2.2.1 Defining regular expressions A regular expression pattern is a sequence of characters that will match sequences of characters in a target. The patterns or regular expressions can be defined as follows: Literal characters must match exactly. Because of the use of backslashes in patterns, you are usually better off defining regular expressions with raw strings, e.g. r"abc". 2.2.2 Compiling regular expressions When a regular expression is to be used more than once, you should consider compiling it. Import sys, re pat = re.compile('aa[bc]*dd') while 1: line = raw_input('Enter a line ("q" to quit):') if line == 'q': break if print 'matched:', line else: print 'no match:', line Comments: We import module re in order to use regular compiles a regular expression so that we can reuse the compiled regular expression without compiling it repeatedly. 2.2.3 Using regular expressions Notes:

Python Course. Uta Priss This is a generic version of a class "Computer Programming for Information Management" that I taught twice a year at the School of Library and Information Science, Indiana University Bloomington. The materials in this course are mostly self-explanatory and can be used for self study. (There are some references in the materials to Indiana University accounts and settings which should be ignored.)

Notes: 1) The materials in this course are copyrighted. 2) Please only contact me in case you find errors in the text or have comments. Please, don't contact me with questions about how to solve the exercises. 3) I will not be responsible for any possible damage that any of the scripts and exercises in this course may have. Week 1. ExercisesAnswers Week 2. Think Python. Hands-on Python Tutorial. This page has materials for Python 3.1 and later, which is incompatible in various ways with earlier versions. If you are using Python 2.5, 2.6, or 2.7, go to the older compatible version here . The Hands-on Python Tutorial formats: Browse web page sections online Zip file for optional download of all web pages.

The web page to open after expanding the zip file is handsonHtml/index.html. This form is useful if you are going to be offline while reading. PDF file in paged format for . Example programs : Zip file for download. For a quick look, you may also browse individual example code files online. The tutorial continues to be updated and expanded. Feedback Appeciated From All I get feedback from my introductory class, but not so much from other people. License and Tutorial Editing The Hands-on Python Tutorial is distributed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License. How to Think Like a Computer Scientist — How to Think Like a Computer Scientist: Learning with Python 3. Version date: October 2012 by Peter Wentworth, Jeffrey Elkner, Allen B. Downey, and Chris Meyers (based on 2nd edition by Jeffrey Elkner, Allen B. Downey, and Chris Meyers) Corresponding author: Source repository is at For offline use, download a zip file of the html or a pdf version (the pdf is updated less often) from Search PageCopyright NoticeForewordPrefacePreface-3 This Rhodes Local Edition (RLE) of the bookContributor ListChapter 1 The way of the programChapter 2 Variables, expressions, and statementsChapter 3 Hello, little turtles!

Learn Python The Hard Way, 2nd Edition — Learn Python The Hard Way. Computer Science. Electrical Engineering and Computer Science | 6.00 Introduction to Computer Science and Programming, Fall 2008. PythonLearn - Self-paced learning Python. Python/Website Programming Applications IV. Module Documents Module Guide Assignment 1 Assignment 2 CGI Demonstrations WPA4 Mailing List Manager LETS trading simulation game. Downloads source code for the CGI Utilities Module version 1. Python and HTML source code for WPA4 list management CGI demonstration programs. and source codes for dropping balls class demo. Calling python code and compiled python code module for bouncing balls class demo. Course Notes and Tutorial/Lab excercises Week 1 Notes 1.1 What is Python ? Week 2 Notes 2.1 Getting user input from the keyboard2.2 if, elif, and else program branches2.3 Comparing numbers and strings2.4 Combining tests with 'not','and' and 'or'2.5 Accessing files on disk2.6 File opening2.7 File output2.8 Input from files2.9 Closing filesWeek 2 Tutorial exercises Week 3 Notes Week 4 Notes Week 5 Notes Week 6 Notes 6.1 Why classes and objects ?

Week 7 Notes Week 8 Notes Week 9 Notes Week 10 Notes Week 11 Notes Week 12 Notes.