Marc Langford Marc Langford - 20 days ago 6
Python Question

Python - how to ask a something that leads on to asking something else?

I need to write a program for a simple "Guess who?" game at univerisity. How would I ask a question i.e "Does he have a beard?" and if thats false ask another question and if true ask a different question?
Sorry a real newbie!

Answer

Didn't quite understand what you were asking, but here's what I gathered.

does_he_have_beard = raw_input("Does he have a beard? ")
does_he_have_beard = does_he_have_beard.lower()
if does_he_have_beard == "false" or does_he_have_beard == "no":
    # Ask another question
if does_he_have_beard == "true" or does_he_have_beard == "yes":
    # Perform other task
Comments