Python excersise The Big If


#1



It's about 'The Big If' in Python, I don't know what the problem is, since the code looks quite okay to me.

The code gives me this errorwhen I try to submit it:

The following exception was raised when calling the_flying_circus(): NameError: global name 'anwser' is not defined


This is the code

def the_flying_circus():
    if anwser <5:
        
        print "Dit is het goede antwoord";
    
    elif anwser >6 :
        
       print "Dit is een antwoord dat niet fout is, maar ook niet     goed"
    
    else:
        
        print "Dit is niet het juiste antwoord"

#2

There is no argument given so none should be used inside the function. answer is not defined.

Please post a link to this exercise so we can review the question and instructions. For sure, the solution is not given in the Hint. That is only a pattern to follow.

Comparison operators:

<, <=, ==, >=, >

Make sure that your program returns True.


#3

You need to place,

As an argument of flying circus,

def the_flying_circus(anwser):

#4

Thank you so much for all your help!
Here is a link to the exercise

https://www.codecademy.com/courses/python-beginner-BxUFN/4/1?curriculum_id=4f89dab3d788890003000096#


#5

Thanks for your help! However, it gives me the error that I shouldn't put any arguments in the_flying_circus :frowning:


#6

In the excercise you are on you are required to use the return statement that will return the boolean True if your if/else blocks are in fact true. So with that in mind you need to consider changing your print''s to return's and restructuring your if and else blocks

and sorry but just remove the argument anwser, my mistake. :slight_smile:


#7

For the record, this is a practice exercise so play with the expressions. Write an if with a comparison that returns True, at least one elif with a comparison that returns True, and an else that returns True. Yes, it seems pointless, but the practice is what is important, here. Not the outcome.


#8

No problem! Thank you!


#9

Thank you for your advice!


#11

A post was split to a new topic: What's wrong?I've tried several times


#12