Python Constructs
This page will be continually updated with a list of Python keywords and
constructs that we've learned in class to date. Python has many capabilities,
functions, and data structures built in to the language and the standard
libraries. Part of the objective of this class is to teach you the basic
software tools of programming, so you are asked to limit your Python
programs to the constructs
that we've learned in class to date and not to use a prepackaged Python
function that does it all for you.
If there's a function not here that you want to use, just ask me.
Updated 19 Sep 2007
- bool, int, float, str, tuple
- operators: +, /, *
- print, type()
- and, or, not
- import, everything in standard math library
- triple-quoted strings
- input(), raw_input()
- sys.stdout.write()
- comments, docstrings
- operators: //, **, %, ==, !=, <>, <, >, <=, >=, is, is
not
- shortcut semantics
- int(), float(), bool(), str()
- print format strings (%d, %f, %s, etc.)
- if, if/else, if/elif/else
- while, break, continue, else
- abs
- +=, -=, *=, /=, etc.
- string.capitalize()
- string concatenation (+), string repetition (*)
- for, range