background preloader

Python-abilia

Facebook Twitter

Popular Python recipes. Welcome, guest | Sign In | My Account | Store | Cart ActiveState Code » Recipes Add a Recipe Languages Tags Authors Sets Popular Python recipes Tags: Recipe 1 to 20 of 4442 « Prev 1 2 3 ... 223 Next »

Popular Python recipes

The Python Wiki. Python is a great object-oriented, interpreted, and interactive programming language.

The Python Wiki

It is often compared (favorably of course ) to Lisp, Tcl, Perl, Ruby, C#, Visual Basic, Visual Fox Pro, Scheme or Java... and it's much more fun. Python combines remarkable power with very clear syntax. It has modules, classes, exceptions, very high level dynamic data types, and dynamic typing. There are interfaces to many system calls and libraries, as well as to various windowing systems . New built-in modules are easily written in C or C++ (or other languages, depending on the chosen implementation ). Getting Started. Python Quick Reference. Python for Software Design: How to Think Like a Computer Scientist. How to Think Like a Computer Scientist by Allen B.

Python for Software Design: How to Think Like a Computer Scientist

Downey This is the first edition of Think Python. It uses Python 2, with notes on differences in Python 3. If you are using Python 3, you might want to switch to the second edition. Buy this book at Amazon.com Download Think Python in PDF. Read Think Python in HTML. Example programs and solutions to some problems are here (links to specific examples are in the book). Description Think Python is an introduction to Python programming for beginners. Some examples and exercises are based on Swampy, a Python package written by the author to demonstrate aspects of software design, and to give readers a chance to experiment with simple graphics and animation. Think Python is a Free Book. If you have comments, corrections or suggestions, please send me email at feedback{at}thinkpython{dot}com.

Other Free Books by Allen Downey are available from Green Tea Press. Download Precompiled copies of the book are available in PDF. Python 3.0 Michael Kart at St. Learn Python - Free Interactive Python Tutorial. Learn Python Through Public Data Hacking. Python Lists. The most basic data structure in Python is the sequence.

Python Lists

Each element of a sequence is assigned a number - its position or index. The first index is zero, the second index is one, and so forth. Python has six built-in types of sequences, but the most common ones are lists and tuples, which we would see in this tutorial. There are certain things you can do with all sequence types. These operations include indexing, slicing, adding, multiplying, and checking for membership.

Python Lists The list is a most versatile datatype available in Python which can be written as a list of comma-separated values (items) between square brackets. Creating a list is as simple as putting different comma-separated values between square brackets. List1 = ['physics', 'chemistry', 1997, 2000]; list2 = [1, 2, 3, 4, 5 ]; list3 = ["a", "b", "c", "d"]; Similar to string indices, list indices start at 0, and lists can be sliced, concatenated and so on. Accessing Values in Lists #!

Updating Lists #! Delete List Elements #! String Formatting - Learn Python - Free Interactive Python Tutorial. Python uses C-style string formatting to create new, formatted strings.

String Formatting - Learn Python - Free Interactive Python Tutorial

The "%" operator is used to format a set of variables enclosed in a "tuple" (a fixed size list), together with a format string, which contains normal text together with "argument specifiers", special symbols like "%s" and "%d". Let's say you have a variable called "name" with your user name in it, and you would then like to print out a greeting to that user. # This prints out "Hello, John! " name = "John" print "Hello, %s! " % name Execute Code To use two or more argument specifiers, use a tuple (parentheses): # This prints out "John is 23 years old.

" name = "John" age = 23 print "%s is %d years old. " % (name, age) Any object which is not a string can be formatted using the %s operator as well. How to Think Like a Computer Scientist — How to Think Like a Computer Scientist: Learning with Python 2nd Edition documentation.

Navigation How to Think Like a Computer Scientist¶ Learning with Python¶ 2nd Edition (Using Python 2.x) by Jeffrey Elkner, Allen B.

How to Think Like a Computer Scientist — How to Think Like a Computer Scientist: Learning with Python 2nd Edition documentation

Downey, and Chris Meyers Last Updated: 21 April 2012 Copyright NoticeForewordPrefaceContributor ListChapter 1 The way of the programChapter 2 Variables, expressions, and statementsChapter 3 FunctionsChapter 4 ConditionalsChapter 5 Fruitful functionsChapter 6 IterationChapter 7 StringsChapter 8 Case Study: CatchChapter 9 ListsChapter 10 Modules and filesChapter 11 Recursion and exceptionsChapter 12 DictionariesChapter 13 Classes and objectsChapter 14 Classes and functionsChapter 15 Classes and methodsChapter 16 Sets of ObjectsChapter 17 InheritanceChapter 18 Linked ListsChapter 19 StacksChapter 20 QueuesChapter 21 TreesAppendix A DebuggingAppendix B GASPAppendix c Configuring Ubuntu for Python DevelopmentAppendix D Customizing and Contributing to the BookGNU Free Document License Search Page.

Learn Python Through Public Data Hacking.