Friday, December 12, 2014

1.3.7 For Loops


My code for the lottery and Mastermind:




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.

     By developing code without iterative loops in some scenarios may make writing the code much more simple, however it would not serve well in complex tasks. Having to rewrite the code several times over would take up much more space than needed, and would make the script much harder to read.

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

      Iteration is very in a variety of ways very useful. When having to loop, say 1000 times for a specific task it is much easier to just have a chunk of simple code that loops a program. Using a 'For' command or a 'While' loop accomplishes the task much faster, and with less work. 
3) What is the relationship between iteration and the analysis of a large set of data?
    Using Iteration you can very easily analyze two large sets of data, regardless of size and potentially compare, or contrast the two lists.

No comments:

Post a Comment