PDA

View Full Version : Lab2


kaufill
12-28-2015, 03:01 PM
Well this assignment, I learned the difference between the 'While' and 'Loop' functions the hard way. I was using the 'Loop' function at first, and there may be some way to make that work, but I surely could not figure it out. It would work for one iteration, but not for multiple. Finally I re-read my book and about smacked myself on the forehead V8-commercial style. Once I fixed that function this assignment was very straight-forward.

One thing I added was if you answer "no", "No", or "NO" to the "Try again?" question, the penguin said "OK, goodbye!" and walked off-screen.

I wanted to add code so that if you didn't answer a variation of "yes" or "no" to the question, the penguin would say "I don't understand" and then the "Try again?" prompt would repeat. However, I couldn't figure out how to make it so that the whole program would respond to the new "Try again?" question like it did in the beginning. Since this wasn't part of the original assignment, I just left it out. However, if anyone could give me a hint as to how I would have fixed this I'd love input! I have attached a screenshot of my method for this part of my program. It's If my variable "runAgain" is not equal to any variation of yes or no, then he says he doesn't understand and walks away. That part works fine. It's the "else" part, where I have copies of my while loop and if function from earlier that control the yes and no options, that it doesn't work.