- 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.
- 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