Main.Area History
Hide minor edits - Show changes to markup
February 04, 2010, at 09:03 AM MST
by -
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
- 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 -
Changed line 1 from:
(:source lang=java:)
to:
(:source lang=python:)
February 02, 2010, at 01:28 PM MST
by -
Added lines 1-21:
(:source lang=java:)
"""Compute the area of a circle"""
import math
- compare this version of area computation
def area1(radius) :
temp = math.pi * radius**2
return temp
- this one:
def area1(radius) :
return math.pi * radius**2
- the latter is more concise, while the former may be easier
- to debug
(:sourceend:)
