Two More Questions¶
Using if
statements with compound conditions
(like and
), 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 elif
or else
or nested if
s.
Question 1: Does it belong inside or outside or both?
Question 2: Is it alive?
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 |
Name your file: two_more_questions.py
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!
©2021 Daniel Gallo
This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Adapted for Python from Graham Mitchell’s Programming By Doing