Activity
1.3.6 Tuples and Lists
Conclusion
1.
Consider
a string, tuple, and list of characters.
In []: a = 'acbde'
In []: b = ('a', 'b', 'c', 'd', 'e')
In []: c = ['a', 'b', 'c', 'd', 'e']
2. The
values of a[3], b[3], and c[3] are all the same. In what ways are a,
b,
and c
different?
A
is different from the other because A is a single string while B and C have
multiple single strings. B and C are different because one is a tuples and the
other is a list. Unlike
tuples, lists are mutable: you can
reassign the value of individual elements in a list.
3. Why
do computer programming languages almost always have a variety of variable
types?
Computer programming languages almost always have a variety of variable
types because it makes the program more efficient for different situations.
4.Why can't everything be represented with an integer?
Everything can't be represented with an integer because not everything requires a integer to be used. For example, if you need to use letters or a string.
No comments:
Post a Comment