15/15


#1

It is working code

def the_flying_circus():
if 3 > 2 and 4 > 2:
return True# Start coding here!
# Don't forget to indent
# the code inside this block!
elif 3 < 2 and 4 < 2:
return False
else:
"ND"
# Keep going here.
# You'll want to add the else statement, too!


#2

make sure your indentation is correct. highlight your code and click the </> in the editor so i can see your indentation


#3

The following implements a simple game, in an attempt at a more interesting solution than the instructions request, and it does pass ...

import random
def the_flying_circus():
    # Pick a randum number of elephants within a specified range.
    low_bound = 1
    high_bound = 20
    elephants = random.randint(low_bound, high_bound)
    guesses = 0
    # Messages will vary depending on whether the guess if too high, too low, correct or invalid
    s = ""
    while True:
        while True:
            # Accept only numbers
            try:
                # Convert input to a number; truncate float to int
                guess = int(float(raw_input(s + "How many elephants are in the circus %s to %s)? "% (low_bound, high_bound) )))
                break
            except:
                s = "Need a number! "
        guesses += 1
        if guess > elephants:
            s = "Too high! "
        elif guess < elephants:
            s = "Too low! "
        else:
            # Guessed it; Do you want to play again?
            play = raw_input("Got it in " + str(guesses) + " guesses!" + " Play again (y/n)? ")
            if len(play) > 0 and play[0].lower() != "y" or len(play) == 0:
                global the_flying_circus
                def the_flying_circus():
                    return True
                return True
            # If we are playing again, pick a new random number of elephants
            elephants = random.randint(low_bound, high_bound)
            guesses = 0
            s = ""

the_flying_circus()

#4

thanks so much
it actually worked