newbie question!

Patrick Useldinger p at trick.lu
Wed Oct 15 13:52:09 EDT 2003


On Wed, 15 Oct 2003 18:33:22 +0100, "Brian" <quigleyb at iol.ie> wrote:

>Hi, im new to python and have a simple question...
>
>i want too have a list of values - say numbers of tables in a restaurant...
>1,2,3,4,5. i want to associate a value with each of these numbers... eg. yes
>or no. when a person books table 2, the value corresponding to 2 turns to no
>[not available] etc...
>

usa a dictionnary, and boolean values True/False:

# initialize
tables = { 1:True, 2:True, 3:True }

# customer reserves table 2
tables[2]=False

# tables is now {1: True, 2: False, 3: True}





More information about the Python-list mailing list