Using if
statements with compound conditions
(like &&
), make a guessing game of two questions
similar to the Twenty Questions
assignment.
However, this time you must accomplish it using if
statements with compound conditions and you must
not use else if
or else
or nested if
s.
Again, here are some sample responses, for the non-creative among you.
inside | outside | both | |
---|---|---|---|
alive | houseplant | bison | dog |
not alive | shower curtain | billboard | cell phone |
TWO MORE QUESTIONS, BABY! Think of something and I'll try to guess it! Question 1) Does it stay inside or outside or both? outside Question 2) Is it a living thing? yes Then what else could you be thinking of besides a python?!?
TWO MORE QUESTIONS, BABY! Think of something and I'll try to guess it! Question 1) Does it stay inside or outside or both? both Question 2) Is it a living thing? no Obviously the nonliving, inside/outside thing on your mind is a dead ant!
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.