Need Help


#1

I am having hard with the final part of conditional and control flow:

Write an if statement in the_flying_circus(). It must include:

if, elif, and else statements;
At least one of and, or, or not;
A comparator (==, !=, <, <=, >, or >=);
Finally, the_flying_circus() must return True when evaluated.
Don't forget to include a : after your if statements!

I have tried everything and nothing works and I need some help.


#2

Can you share what you've done?


#3


#4

elif 5 == 5:
    return True
    else:
        else:
            return True

Your else seems to be indented under elif. else is used after using an if or elif statement. But there isn't any before else that is nested under the elif. Do you mean to make it lined up with it? Such as

elif 5 == 5:
    return True
else:
...

You also seem to have two elses....why?

else is always used after an if or elif. It's like the last resort condition when all others before it are not satisfied.


#5

What's the right code.


#6

The code you shared is close!
Just fix the area I pointed out and it should work.
I can't just provide you a code because any is fine as long as it satisfies the instructions. Plus, it's not effective in terms of learning.


#7

I tried that and it still doesn't work.


#8

Look at the indent of this and compare it with yours.


#9

It is still not working


#10

Unindent your else statement so that it lines up with your elif like this example:

elif foo == "foo":
    return "foo"
else:
    return "foo foo"

Right now, you have something like:

elif foo == "foo":
    return "foo"
    else:
        return "foo foo"

Notice the difference?


#11

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.