Online Programming Server

Login

Login with facebook [?]

Facebook

Tutorial 70: CSCI1040 - Lecture 3: Dictionaries, OOP, Functional Programming

You are here: Tutorials >> Basic >> Python >> Hands-on Introduction to Python >> CSCI1040 - Lecture 3: Dictionaries, OOP, Functional Programming

Tutorial ID70
TitleCSCI1040 - Lecture 3: Dictionaries, OOP, Functional Programming

Dictionaries

  • Indexed data structure - uses also square bracket notation
  • Any immutable type can be used as index
  • Braces create dictionary
>>> dct = { } # create new dictionary
>>> dct['name'] = 'Donald Duck‘
>>> dct['age'] = 63
>>> dct['eyes'] = 'black‘
  • Index is called a key (LHS)
  • Element stored that associated with key is called a Value (RHS)

Post Your Comment

Title
Message