Exercises, examples and other material relating to training module Y107. This topic is presented on public courses
Learning to program in Python,
Python Programming
If a Python list were like a pencil, then a Python Tuple would be like a pen.
Most programming languages include structures in which you can hold a ... http://www.wellho.net/solutions/python-p ... onary.html [longer article] |
Python Programming - The fundamentals in depth, and an introduction to applications such as GUI design and Data Munging.
This course starts at the fundamentals ... http://www.wellho.net/course/ypfull.html [course] |
Learning to Program in Python - The fundamentals in depth, and an introduction to applications such as GUI design and Data Munging.
This course starts ... http://www.wellho.net/course/ylfull.html [course] |
#!/usr/local/bin/python
author = {"php":"Rasmus Lerdorf",\
"perl":"Larry Wall",\
"tcl":"John Ousterhout",\
"awk":"Brian Kernighan",\
... http://www.wellho.net/resources/ex.php4?item=y107/d3.py [code sample] |
Some more new examples in Python - from this week's course.
From my Introduction to Python / simple example to show the power of the language, I present ... http://www.wellho.net/mouth/2368_Pyt ... ntals.html [short article] |
If you have two lists in Python and you want to use them as the keys and values of a dictionary, you might be interested on Python's zip function. It's ... http://www.wellho.net/mouth/1145_Usi ... n-zip.html [short article] |
Using a dictionary in Python, you can avoid the need for a loop in your program to search out elements in a collection. Suppose, for example, you have ... http://www.wellho.net/mouth/1144_Pyt ... k-ups.html [short article] |
Lists and tuples are collections of data values held in an object in which they can be referenced by a position number. Dictionaries are mutable collections of objects in which data values can be looked up name.
This topic is presented on public courses
Learning to program in Python,
Python Programming
Examples from our training material
| coin.py | Class used by dictionary with object key example |
| d1.py | Defining and looking up in a dictionary |
| d2.py | Looping through all the elements of a dictionary |
| d3.py | Can I sort a dictionary? |
| file_2nd | Analysing blog accesses |
| pocket.py | dictionary with object keys - example |
| pred.py | Illustration of a program that would benefit from dictionaries |
| pres.py | Is a key used in a disctionary? |
| slowcoach | Analysing visit lengths to web site - no cache |
| snork | Variable scope when sorting a dictionary by value |
| visitors | Analysing visit lengths to web site - using cache |
| zip-it.py | Joining 2 lists into a dictionary |
Pictures
Practical session on a Python course
Background information
Some modules are
available for download as a sample of our material or under an
Open Training Notes License for free download from
http://www.training-notes.co.uk.
Topics covered in this module
What is a dictionary.
Dictionary operators and methods.
Iterating through a Dictionary's keys.
For, range and xrange.
Counting and existance.
Sorting
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our
Listing and schedule page.
Well House Consultants specialise in training courses in
Python,
Perl,
PHP, and
MySQL. We run
Private Courses throughout the UK (and beyond for longer courses), and
Public Courses at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if
you live in a different
country or continent to us.
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.