Create a finite group in $S_4$ in sage
$H=\{(),(1,2)(3,4),(1,3)(2,4),(1,4)(2,3) \}$
can make a cyclic group out of them with
S4 = SymmetricGroup(4)
v1=S4((id))
v2 = S4("(1,2)(3,4)")
v3 = S4("(1,3)(2,4)")
v4=S4("(1,4)(2,3)")
v2*v3
can go one to find right or left cosets
S4.cosets(H, side='right')
S4.cosets(H, side='left')
H.list() will list
make table
H.cayley_table()
can find sing of elements of $S_4$
sigma.sign()
but cant make that group
after commnets
Link sage example its "not psude code"!!
https://cocalc.com/projects/63d635fd-6ae0-4732-afdb-6ef4f5103c5d/files/2017-10-18-083014.sagews
Build your subgroup with the following code:
The reason your code doesn't work is that you only defined a subset of $S_4,$ and sage got grumpy because it believes that objects have an associated "type."