1 | initial version |

Hello,

First of all, your code works! The problem is that you need to specify a value to the variables a and b. The best way should be to put all that in a function as in the following

```
def euclide(a,b):
r=a%b
print (a,b,r)
while r != 0:
a=b; b=r
r=a%b
print (a,b,r)
```

Then you can do

```
sage: eudlide(12,5)
(12, 5, 2)
(5, 2, 1)
(2, 1, 0)
```

To use an external file, it depends on how do you use Sage : in a console or with the notebook ?

Vincent

2 | fixed typo |

Hello,

First of all, your code works! The problem is that you need to specify a value to the variables a and b. The best way should be to put all that in a function as in the following

```
def euclide(a,b):
r=a%b
print (a,b,r)
while r != 0:
a=b; b=r
r=a%b
print (a,b,r)
```

Then you can do

`sage: `~~eudlide(12,5)
~~euclide(12,5)
(12, 5, 2)
(5, 2, 1)
(2, 1, 0)

To use an external file, it depends on how do you use Sage : in a console or with the notebook ?

Vincent

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.