Friday, December 12, 2014

1.3.7 Loops

            Loops




           Lottery Ticket













             Hangman 














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.

          Using "unrolled loops" has its disadvantages during development because it is very tedious work, boring, and its just really really inefficient. It would be a pain to change an unrolled loop of "for i range(10) to "for i range(1000)".


2.      Name a large collection across which you might iterate.

            A department store computer could iterate over a list of items in stock.


3.      What is the relationship between iteration and the analysis of a large set of data?

          Iteration reads and changes information about each item, where as data analysis only reads from them to get statistics. However both iteration and data analysis deal with large amounts of data.



No comments:

Post a Comment