Thursday, December 11, 2014

1.3.8 Guesser Thing






  1. If you change between 1 and 20 from the previous program to between 1 and 6000, how many guesses will you need to guarantee that you have the right answer? Explain.
You would need 6000 guesses, because you could guess 1 then 2 then 3, and if the correct number was 6000, you'd need 6000 guesses. I guess. 
  1. Describe the difference between a while loop and a for loop.

While will continue until a certain variable changes, and it can be affected mid-way through its run-time. A for loop will run a specific amount of time, and you can't change the amount of times it is run. 



No comments:

Post a Comment