def rotate_digits(digits, shift): shift = shift % len(digits) return digits[-shift:] + digits[:-shift] # rotate_digits('123', 1) → '312'