[Tutor] Variables (with lists??)

Chris Kavanagh ckava1 at msn.com
Wed Nov 23 05:15:49 CET 2011


I was going over one of Derek Banas' tutorials on youtube, and came 
across something I hadn't seen before. A variable with a list beside it 
(see code below). He sets the variable, customer , equal to a dict. Then 
uses the variable with ['firstname'],['lastname'], ect. I've never seen 
this in my short programming life. What is this called? And is there any 
documentation on it?? I tried to google it, but had no idea what to 
google, lol. The code below is just partial code. . .

Thanks for the help, and I hope everyone has a happy Thanksgiving!




customer = {}

print “Add a new customer to the database\n”

custNum = raw_input(‘Enter a customer number: ‘)
customer['firstName'] = raw_input(‘Customer First Name: ‘)
customer['lastName'] = raw_input(‘Customer Last Name: ‘)
customer['streetAdd'] = raw_input(‘Customer Street Address: ‘)
customer['city'] = raw_input(‘Customer City: ‘)
customer['state'] = raw_input(‘Customer State: ‘)
customer['zip'] = raw_input(‘Customer Zip Code: ‘)


More information about the Tutor mailing list