Determining Pythagorean triples based on the hypotenuse
First, let's write this with a little style, and go from there:

import math

def is_triple(hypotenuse):
    """return (a, b, c) if Pythagrean Triple, else None"""
    if hypotenuse &lt; 4:
        return None

    c = hypotenuse ** 2

    for a in xrange(3, hypotenuse):
        b = math.sqrt(c - (a ** 2)) 
        if b == int(b):
            return a, int(b), hypotenuse

    return None


Now, I'll walk you through it, line by line, and show you how I got this.

I have no idea if this is more efficient, but it is written in better style, which is an important thing to consider.

import math


Always put your imports at the top of the module.

def is_triple(hypotenuse):


Here is say 'let's define some functionality, and encase a repeatable, reusable pattern of logic within it. The rest of my answer revolves around this, and is a major first step to programming in Python.

def is_triple(hypotenuse):
    """return (a, b, c) if Pythagrean Triple, else None"""


Note the """ triple quotes. That's your docstring, something that reminds you later what you were thinking when you wrote something. Try to keep it under 65 characters or so.

if hypotenuse &lt; 4:
    return None


In the first line, def is_triple(hypotenuse):, I ask the user to give me something; a variable that I can use later. If I later call this function in the manner is_triple(5), I am basically telling the function that my hypotenuse is 5, and for the rest of the time here, we'll call it hypotenuse. 

c = hypotenuse ** 2


That's really all you need for this calculation right now.

for a in xrange(3, hypotenuse):
        b = math.sqrt(c - (a ** 2)) 
        if b == int(b):
            return a, int(b), hypotenuse


for a in xrange(3, hypotenuse) basically says for each whole number between 3 and the hypotenuse, do the stuff I'm about to write.

Following the previous example,

&gt;&gt;&gt; range(3, hypotenuse) #hypotenuse is == 5
[3, 4]


Nevermind that I call xrange(), it functions the same as far as we're concerned here, and importantly, is more efficient.

So now that we've made a loop, a will act as though it is each number in [3, 4], so first, it's 3:

b = math.sqrt(c -  (a ** 2))
b = math.sqrt(25 - (3 ** 2))
b = math.sqrt(25 - (9))
b = math.sqrt(16)
b = 4.0


Just like you would on pencil and paper. Notice I put a .0 after, the four. That's important here:

if b == int(b):


Basically, int puts the number b from a decimal to a whole number. We just check if they're the same.

&gt;&gt;&gt; int(4.0)
4
&gt;&gt;&gt; int(4.0) == 4
True


So, if the number we got for b is the same as the whole number representation of b, do the next part:

return a, int(b), hypotenuse


Which maps a value back to whatever you called as an assignment for the function call.

&gt;&gt;&gt; values = is_triple(5)
&gt;&gt;&gt; values
(3, 4, 5)
&gt;&gt;&gt; wrong = is_triple(7)
&gt;&gt;&gt; wrong
&gt;&gt;&gt; #it didn't print anything, because it gave me back None


Finally, at the bottom:

return None


That's the last thing to catch, in case nothing else happens. Obviously, if you've gone through this loop and you haven't gotten an answer? Well, looks like you don't have a match. Give back a None to denote this.

To see this work in action, try this:

&gt;&gt;&gt; import pprint
&gt;&gt;&gt; pprint.pprint([{x: is_triple(x)} for x in xrange(101)])