The big if


#1

this is my code **# Make sure that the_flying_circus() returns True

**def the_flying_circus():**
**    if ________:    # Start coding here!**
**        # Don't forget to indent**
**        # the code inside this block!**
**    elif ________:**
**        # Keep going here.**
**        # You'll want to add the else statement, too!**

this is my problem
Oops, try again. An exception was raised while running your code, see the console window for the error message.**


My borders are not working!?
My borders are not working!?
#2

You should write the conditon of the if and elif statement


#4

@wizmarco help me plz by copy and pasting it


#5

@qboyswag8 i created a topic for you, please use this topic. Giving answers (and asking for answers) is not according the guidelines, the code you posted to the forum seems like the code provided by the exercise.

If you don't remember, look at documentation and earlier exercises. We can help you with problems, we are not going to complete the exercises for you


#6

def the_flying_circus():
if a < 21:
print ("Let's have a pint!")
return True
elif a > 21:
print ("Go home yo.") and ("Grow a little.")
return False
if a == 21:
print ("Let's have a pint!")
return True
input ("Enter your age.")

It always tells me to include the elif, and, or, etc and doesn't work but furthermore, when I copy and paste it into visual studio, when I run it, it asks my age and then the program comes to an end. I realize that my request for input must be in the wrong spot but I've experimented with putting it in different spots and it never seems to work. So, what do I need to do to make my input recognized and put through the operator questions?


#7

Hi you made the if and elif statement

def the_flying_circus():
    if a < 21:
        print ("Let's have a pint!")
        return True
    elif a > 21:
        print ("Go home yo.") and ("Grow a little.")
        return False

first it's better if the input("Enter your age") is on top of all the if, elif statement and this line

print ("Go home yo.") and ("Grow a little.")

you should remove the and ("Grow a little.") because it won't be print..

Hint

#your should look like that 

def the_flying_circus():
    input("Enter your age")
    if a < 21:
        print ("Let's have a pint!")
        return True
    elif a > 21:
        print ("Go home yo.")
        return False

#don't forget to call the function
the_flying_circus()

and in your condition you need of at least on boolean ...
Then you added again a if statement which should be a else statement

if a == 21:
print ("Let's have a pint!")
return True

And
remenber that the function should return True


#8

Thank you very much for the response. It took me a bit more playing around to get things figured out but with your help, doing the code academy project, and figuring out this thing with a couple extra steps in visual studio, I feel like I learned a lot so far today!


#9

The print commands are kind of redundant, as long as it returns a True, it'd still work :slight_smile: