The Big If


#1

Here is my code:

# Make sure that the_flying_circus() returns True
def the_flying_circus():
    if the_flying_circus():
      print 11 == 8 + 3
      return True
    elif the_flying_circus():
      print 30 + 4 == 11 * 5
    return True
    else:
     print
     return True 
    the_flying_circus() 

This is the error I keep receiving An exception was raised while running your code, see the console window for the error message.


#2

Hi @grets_can_code,

In order to help you, we’re going to need a few things:


#3

Make sure that the_flying_circus() returns True

def the_flying_circus():
if the_flying_circus():
print 11 == 8 + 3
return True
elif the_flying_circus():
print 30 + 4 == 11 * 5
return True
else:
print
return True
the_flying_circus()
I don’t know how to link to my lesson this is my code


#4

To provide a link, simply copy and paste the url of the lesson.

Also, your code is still not formatted, please see:


#5

https://www.codecademy.com/courses/learn-python/lessons/conditionals--control-flow/exercises/the-big-if?action=lesson_resume&link_content_target=interstitial_undefined


#6

Make sure that the_flying_circus() returns True

def the_flying_circus():
if the_flying_circus():
print 11 == 8 + 3
return True
elif the_flying_circus():
print 30 + 4 == 11 * 5
return True
else:
print
return True
the_flying_circus()


#7

Ehhh… close enough.

Alright, I believe you are not entirely understanding what the instructions are telling you to do…

Instructions:


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!


the_flying_circus() would only be a valid if condition, if it had already been defined. As it is right now, it causes an infinite loop.


#8

This causes a circular reference which is an infinite loop.

```python
def the_flying_circus():
    return True
```

I’ve left out all the code so we could focus on how the sample is formatted using markdowm.

Finished result…

def the_flying_circus():
    return True

Now look at your Opening Post as a code sample (errors, notwithstanding)…

Markdown gives us the ability to express our code, and other idiomatic psuedo-code. Using it we preserve the format given in our source, if it is indeed source code. In pseudo-code it lets us define structure so our ideas don’t just run on. All in all, it is a valuable communication tool in this environment where plenty of code and ideas abound. Make sense?


#9

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