[Tutor] Fwd: Fw: Traceback
dyoo at hashcollision.org
Wed Nov 19 02:01:52 CET 2014
---------- Forwarded message ----------
From: niyana morgan <niyanaxx95 at gmail.com>
Date: Tue, Nov 18, 2014 at 4:59 PM
Subject: Re: [Tutor] Fw: Traceback
To: Danny Yoo <dyoo at hashcollision.org>
def distance(x1, y1, x2, y2):
dx = x2 - x1
dy = y2 - y1
dsquared = dx**2 + dy**2
result = math.sqrt(dsquared)
On Nov 18, 2014 7:56 PM, "Danny Yoo" <dyoo at hashcollision.org> wrote:
> On Tue, Nov 18, 2014 at 4:48 PM, niyana morgan <niyanaxx95 at gmail.com> wrote:
> > Read the link. So I need to put
> > Return roomWidth and roomLength? ??
> You may want to practice writing functions that return useful values.
> Save the work you've go so far, and then open up a new program.
> Go through that link again in:
> but this time, also do Exercise 1 in that chapter.
> Write a compare function that returns 1 if x > y, 0 if x == y, and
> -1 if x < y.
> Do this and show us what it looks like.
> I'm asking you to do this as side work because, at the moment, you've
> just been exposed to a new thing, and you're tempted to just hack it
> into your original program to make it "work". This is not the best
> approach. Instead: practice the new technique on small programs.
> Then once you know what you're doing, you can go back to the original
More information about the Tutor