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']
The
values of a[3], b[3], and c[3] are all the same. In what ways are a,
b,
and c
different?
The ways that a,b, and c are different is that a is a string, b is a tuple, and finally c is a list.
2.
Why
do computer programming languages almost always have a variety of variable
types?
Not everything can be answered with one variable type. For example, some situations require a true or flase statement whereas others require a number. These variables would have to be two different types.
3.Why can't everything be represented with an integer?
Not all situations require an integer. Some require a true or false. Others require a float in that of a decimal places need to be accounted for.
No comments:
Post a Comment