Quotes help make search much faster. Example: "Practice Makes Perfect"

Saturday, November 24, 2012

Codecademy: "The Big If"


#sample solution


def the_flying_circus():
    #Start coding here!
    if True and not False:
    return True
    elif (1 != 2) or (1 < 2):
    return True
    elif (3 <= 3):
        return True
    elif (4 == 4) and (5 >= 3):
    return True
    elif (4 > 2):
    return True
    else:
    return False

4 comments:

  1. Another solution here:

    def the_flying_circus():
    if 3 < 4 and not 3 < 4: # Start coding here!
    return True
    print the_flying_circus()
    # Don't forget to indent
    # the code inside this block!
    elif 3 != 4 and 3 > 4:
    return False
    print not the_flying_circus()
    else:
    return True
    print not the_flying_circus()

    ReplyDelete
  2. Here is another solution:

    # Make sure that the_flying_circus() returns True
    def the_flying_circus():
    if (3 + 4) == (5 + 2): # Start coding here!
    return True # Don't forget to indent
    # the code inside this block!
    elif 100 == 10 ** 2:
    return True
    else: return False
    print the_flying_circus
    # Keep going here.
    # You'll want to add the else statement, too!

    ReplyDelete
  3. def the_flying_circus():
    if 2<4 and 3<4:
    return True
    elif 2>4:
    return False
    else:
    print "crazy"

    ReplyDelete
  4. # Make sure that the_flying_circus() returns True
    def the_flying_circus():

    if 8 >= 8 and "A" == "A" : # Start coding here!
    return True # Don't forget to indent
    print "Ok"# the code inside this block!
    elif 3 < 8 :
    return False # Keep going here.
    print "Opps" # You'll want to add the else statement, too!
    else:
    print "Smth"

    ReplyDelete


This is an example of scrolling text using Javascript.

Popular Posts