Main.Area History

Hide minor edits - Show changes to markup

February 04, 2010, at 09:03 AM MST by 71.196.160.210 -
Changed lines 3-4 from:

"""Compute the area of a circle"""

to:

"""Compute the area/circumference of a circle"""

Changed line 15 from:

def area1(radius) :

to:

def area2(radius) :

Added lines 20-31:

def circumference(radius) :

    return 2 * math.pi * radius
  1. here's how to return multiple values from a function:

def area_circ(radius) :

    return area1(radius), circumference(radius)

if __name__ == _main_ :

    area, circumference = area_circ(1)
    print area, circumference
February 02, 2010, at 01:29 PM MST by 129.82.44.241 -
Changed line 1 from:

(:source lang=java:)

to:

(:source lang=python:)

February 02, 2010, at 01:28 PM MST by 129.82.44.241 -
Added lines 1-21:

(:source lang=java:)

"""Compute the area of a circle"""

import math

  1. compare this version of area computation

def area1(radius) :

    temp = math.pi * radius**2
    return temp
  1. this one:

def area1(radius) :

    return math.pi * radius**2
  1. the latter is more concise, while the former may be easier
  2. to debug

(:sourceend:)