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?
They are different because one of them was taken out of a complete string, one was taken from a list, and one was taken from a set of strings.
List: Elements of list can be changed
Tuple: Elements of tuple cannot be changed
String: Is a whole
2.
Why
do computer programming languages almost always have a variety of variable
types? Why can't everything be represented with an integer?
There are a variety of types so that if you need to put different values together you can make it easier. Everything can not be an integer because some things can not be represented by a number
No comments:
Post a Comment