Friday, December 12, 2014

Activity 1.3.7



 

Conclusion
1.      Sometimes code using an iterative loop can be written without a loop, simply repeating the iterated code over and over as separate lines in the program. Explain the disadvantages of developing a program this way.
 It is very inefficient and tedious.
2.      Name a large collection across which you might iterate.
 The hardware store would iterate list for what they have in stock. 
3.      What is the relationship between iteration and the analysis of a large set of data?
 Iteration changes information about each item in data and data analysis only reads their statistics.

Monday, December 8, 2014

Activity 1.3.6 Tuples and Lists



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.