• + 3 comments

    Same idea, but if d is an integer with no restrictions, this works:

        shifted = a[d%n:] + a[:d%n]
        for num in shifted:
            print(num, end=' ')