Computers/Language python
String vs. List vs. Dictionary
emzei
2012. 3. 14. 19:46
String : 'hello'
- sequence of character
- immutable
error : s[i] = 'x'
- s[i] : i th character in s
List : ['alpha', 23]
- list of elements
- mutable
- p[i] : i th element of p
Dictionary : { 'hydrogen':1 , 'helium' : 23 }
- set of <key, value> pairs
- mutable
- d[k] :
k : key
value associated with k in d