Tutorial - Learn Python in 10 Minutes - Stavros' Stuff - Stumble Upon
Tutorial - Learn Python in 10 Minutes - Stavros' Stuff - Stumble Upon
Preliminary fluff
So, you want to learn the Python programming language but can't find a
concise and yet full-featured tutorial. This tutorial will attempt to teach
you Python in 10 minutes. It's probably not so much a tutorial as it is a
cross between a tutorial and a cheatsheet, so it will just show you some
basic concepts to start you off. Obviously, if you want to really learn a
language you need to program in it for a while. I will assume that you
are already familiar with programming and will, therefore, skip most of
the non-language-specific stuff. The important keywords will be
highlighted so you can easily spot them. Also, pay attention because,
due to the terseness of this tutorial, some things will be introduced
directly in code and only briefly commented on.
Properties
Python is strongly typed (i.e. types are enforced), dynamically,
implicitly typed (i.e. you don't have to declare variables), case
sensitive (i.e. var and VAR are two different variables) and object-
oriented (i.e. everything is an object).
Getting help
Help in Python is always available right in the interpreter. If you want to
know how an object works, all you have to do is call help(<object>)!
Also useful are dir(), which shows you all the object's methods, and
<object>.__doc__, which shows you its documentation string:
! +++,-./01%2 L
" 3./0,45,657,489.:7;
# 1.7:,.7:2
$ ,
% +++,<6=1%2
& >?@@A8B@@?C,?@@A<<@@?C,DDDE
' ,
( +++,A8BD@@<4:@@
) ?A8B15FG8.=2,!+,5FG8.=
!* ,
!! H.7F=5,7-.,A8B4/F7.,IA/F.,4J,7-.,A=KFG.57D?