Latin square in Python?
Could anyone help me make a program to generate a Latin square in python?
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))
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.
Problem Statement Given two integers a and b, your task is to calculate and print the following four values:
Please help, any idea?