2. List, Set, Tuple
·
Python
Lists¶ Lists group together data -- the data can be a mix of integers, floating point or complex numbers, strings, or other objects (including other lists). In [2]: a = [1, 2.0, "my list", 4] In [3]: print(a) [1, 2.0, 'my list', 4] In [4]: type(a) Out[4]: list In [5]: print(a[2]) # remember, 0-based indexing my list In [6]: b = ['another string'] a + b Out[6]: [1, 2.0, 'my list', 4, 'another str..
1. Data Types
·
Python
Basic Python Datatypes¶ This notebook explores the basic python datatypes. Some examples come from the python tutorial: http://docs.python.org/3/tutorial/ For IPython help, visit: http://ipython.org/ipython-doc/dev/interactive/notebook.html Some useful short-cuts: shift+enter = run cell and jump to the next (creating a new cell if there is no other new one) ctrl+enter = run cell-in place alt+ent..