The Big if (What did I do wrong?)


#1

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

Return is outside function
File "python", line 11
SyntaxError: 'return' outside function

I dont understand why return is outside of the function, indentation maybe...?

Replace this line with your code. 

def the_flying_circus(): True
if (1 == 1) and (17 != 38):  
    print "Hello Jordan! YES, the code worked... (for once)"
      
elif the_flying_circus() == False:
    print "!*#%@$@#!#, the code didn't work... (as expected)"

else:
    print "Just give up..."
    return True

#2

The code is set up with included return statements. Why remove them? READ the instructions closely, and start by Reseting your exercise to get rid of all the GIGO.


#3

When I try something different

def the_flying_circus():

if (1 != 1) or (1 == 1):  
    print "True"

elif (1 <= 1) and (2 <= 2):
    print "False"   

else:
    print "False"

I get the message "the_flying_circus() returned the value of None, did you forget to add a return statement?"
Which makes me think that a return statement is needed. How would I fix that problem?


#4

By following the instructions. Instead of printing a string value for True or False, return the boolean.

return True

#5

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