Total new question here - and I know a similar question has been asked before - but I've done a bit of work on this and I'm stuck, so I'd appreciate some help.

The exercise I'm stuck on is this:

Write a function that implements Euclid's method for finding a common factor of two numbers. It works like this:

1. You have two numbers, a and b, where a is larger than b

2. You repeat the following until b become zero

3. a is changed to the value of b

4. b is changed to the remainder when a (before the change) is divided by b (before the change)

5. you then return the last vaule of a

This is what I've come up with:

```
def fac(a,b): #defining the function that uses Euclid's method
while b>0:
a, b = b, a%b # changing the numbers a to b, and b to remainder of a/b
return a
a = input("Please define a number for 'a': ") #getting numbers a and b from user
b = input("Please define a number for 'b': ")
a,b = max(a,b),min(a,b) #making sure a>b
euclid = fac(a,b) #running the function on a and b
print euclid #printing the result
```

But it doesn't work and just prints b. I can't see why. Please help by explaining where the problem lies.

Thanks for your time.

Jim