+ 1

Latin square in Python?

Could anyone help me make a program to generate a Latin square in python?

2nd Oct 2019, 10:16 PM
Brody
2 Answers
+ 1
from collections import deque mydeque = deque([1, 2, 3, 4]) for x in range(0, len(mydeque)): print(list(mydeque)) mydeque.rotate(-1) # or use mylist = [1, 2, 3, 4] for x in range(len(mylist)): print(mylist) mylist.append(mylist.pop(0))
2nd Oct 2019, 10:58 PM
rodwynnejones
rodwynnejones - avatar
0
Use deque from collection module and implement it's 'rotate' method. I'l give you a few minuets for you to have a go...just please... try something yourself first.
2nd Oct 2019, 10:32 PM
rodwynnejones
rodwynnejones - avatar