Main.Divisibility History

Hide minor edits - Show changes to markup

February 02, 2010, at 01:30 PM MST by 129.82.44.241 -
Added lines 1-19:

(:source lang=python:)

"""Example showing how functions that return a boolean value can be written very concisely"""

def is_divisible(x, y) :

    """determines if x is divisible by y"""
    if x % y == 0:
        return True
    else:
        return False
  1. a more concise way of writing this function:

def is_divisible_concise(x, y) :

    """determines if x is divisible by y"""
    return x % y == 0:

(:sourceend:)