Need help to Solve this Python Program

Any other different approaches to solve this problem?

Problem statement: Write a python program to split the array and move the first part to the end.

Using this python compiler I have executed the following code: https://www.interviewbit.com/online-python-compiler/ 

def splitArr(arr, n, k): 
for i in range(0, k):
x = arr[0]
for j in range(0, n-1):
arr[j] = arr[j + 1]

arr[n-1] = x


# main
arr = [13, 11, 6, 7, 50, 37]
n = len(arr)
position = 2

splitArr(arr, n, position)

for i in range(0, n):
print(arr[i], end = ' ')
0

Please sign in to leave a comment.