Hello, I want to write this algorithm in sage, I know sage is python base but I'm not much familiar with this programming language so I'm working on it.. Could you please tell me how can I write Buchberger algorithm in sage? I know there is commands for computing it, but I want the algorithm..

input= (f1, ,fs)

output= a groebner basis G={ g1,...,gt} for f ? G

initialization :

G=F

*g*:= {(fi,fj) | fi,fj ? G , fi?fj }

h:=0

iteration

```
WHILE *g* ? 0 DO
choose any {f,g} ? *g*
*g*:= *g* \ {{f,g}}
h:= (s(f,g)) ?^G
IF h ? 0 THEN
*g* := *g* ? {{u,h}| u ? G }
G:= G ? {h}
```