Tuesday, December 9, 2014

1.3.7 Options


This was the code for the Lottery option. You had to input your ticket numbers, and it created the winning numbers. It gave you an output of the number of similar numbers.


This is the code for Hangman. Running hangman() will initiate it. It stops after the word is guessed. I stored the words as lists, not strings. So ['w','o','r','d'] not "word."


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.

This would make the code very long and repetitive, and would make it very difficult to change the iteration. 

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

A list of words, like names or words in a text document, or if you were searching for a word in that document. You would want to iterate through it, it would be nearly impossible without iteration.

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

To analyze a large set of data, you'd need to iterate through it to read each piece of data.



No comments:

Post a Comment