1.3.7 For Loops
Mastermind
Lottery Ticket
Questions:
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.
If a program is developed this way, it will take up much more space, be more time consuming, and take longer to run than if the code were just created with a loop.
2. Name a large collection across which you might iterate.
A collection of music, perhaps to make sure two directories have the same exact songs and to fill the ones that are missing from each other. my collection has about 900 songs, and the are people with much bigger ones out there.
3.What is the relationship between iteration and the analysis of a large set of data?
One can generate a program to iterate a block of code that preforms an action on each datum in the set. For example, a program could examine a set of numbers and for each number that is over 10, increase a variable by 1.
A collection of music, perhaps to make sure two directories have the same exact songs and to fill the ones that are missing from each other. my collection has about 900 songs, and the are people with much bigger ones out there.
3.What is the relationship between iteration and the analysis of a large set of data?
One can generate a program to iterate a block of code that preforms an action on each datum in the set. For example, a program could examine a set of numbers and for each number that is over 10, increase a variable by 1.
No comments:
Post a Comment