How are array types (lists and tuples) and for loops related in Python? -
how array types (lists , tuples) , loops related in python? little bit confused. english new.
lists:
- they mutable; is, elements inside of permitted change.
- they use bracket notation
[]
.
tuples:
- they immutable; is, elements comprised of not permitted change.
- they use parentheses notation
()
. - perform little faster due immutability.
both lists , tuples:
- can iterated on (
for x in elements
) - can sliced (
elements[1:3]
) - can indexed (
elements[0]
)
Comments
Post a Comment