tutorial example
john boy
xray_alpha_charlie at yahoo.com
Fri Nov 11 20:50:26 EST 2005
Can somebody tell me why you have to have "return result" in the below program as suggested in a beginner tutorial. I ran the second listed program below without "return result" and they both give the same value in Python interpreter. What does "return result" do?
def distance(x1, y1, x2, y2):
dx = x2 - x1
dy = y2 - y1
dsquared = dx**2 + dy**2
result = math.sqrt(dsquared)
print result
return result
def distance(x1, y1, x2, y2):
dx = x2 - x1
dy = y2 - y1
dsquared = dx**2 + dy**2
result = math.sqrt(dsquared)
print result
---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051111/d973cfee/attachment.html>
More information about the Python-list
mailing list