Should my code look like this?


#1

This is my final code for 15/15 "The Big If"
# Make sure that the_flying_circus() returns True
def the_flying_circus():
if 17 > 9 and 9 > 4: # Start coding here!
return True
# the code inside this block!
elif 9 < 8 or 10 < 6:
return False
# Keep going here.
# You'll want to add the else statement, too!
else:
return "Check your numbers.."

It passed the lesson, but it only returned "None" in the output box. I am not sure if I got the code exactly right.


#2

@reianna_bryant,
With

def the_flying_circus():
    if 17 > 9 and 9 > 4: # Start coding here!
        # the code inside this block!
        return True
    elif 9 < 8 or 10 < 6:
        return False
    # Keep going here.
    # You'll want to add the else statement, too!
    else:
        return "Check your numbers.."

#you have defined a flying_circus function.

#Now you can call this flying_circus function

flying_circus()

But as you used the return statement,
you will get a return Value with NO-Display

There a 2 possibilities to get a Displayed return Value

01 You capture the return Value into a variable and then print this variable

the_result = flying_circus()
print the_result

02 You directly print the return Value

print flying_circus()

#3

@reianna_bryant,
Next time when you present you code,

  • leave one blank-line above of the code
  • select the code
  • click on the </> pre-code button of this editor
    ( a 4-spaces indention is added to all of your code, your code in pre-code mode )

Please re-edit your Post

  • leave one blank-line above of your code
  • select your code in the Post
  • then =click= on the </>-symbol-of-this-editor

Your code will then be in a pre-code state
and you will be able to make/present the proper indentations.