Creating an Array: Difference between revisions
Content added Content deleted
(Lists with other lists) |
(tuples) |
||
Line 347: | Line 347: | ||
[[Category:Python]] |
[[Category:Python]] |
||
⚫ | |||
empty = [] |
empty = [] |
||
numbers = [1, 2, 3, 4, 5] |
numbers = [1, 2, 3, 4, 5] |
||
zeros = [0] * 10 |
zeros = [0] * 10 |
||
⚫ | |||
anything = [1, 'foo', 2.57, None, zeros] |
anything = [1, 'foo', 2.57, None, zeros] |
||
Tuples are immutable arrays. Note hat tuples are defined by the "," - the parenthesis are optional: |
|||
empty = () |
|||
numbers = (1, 2, 3, 4, 5) |
|||
zeros = (0,) * 10 |
|||
anything = (1, 'foo', 2.57, None, zeros) |
|||
==[[Toka]]== |
==[[Toka]]== |