79153675

Date: 2024-11-03 21:28:07
Score: 1
Natty:
Report link

Here is a function for splitting a list into 2 parts with random numbers.

lst = [1, 2, 3, 4, 5, 6]
def split(lst,x):
    split=lst[:x]    
    return split

def rest_lst(lst,x):
    rest_lst= lst[x::]
    return rest_lst

print(split(lst,2))
print(rest_lst(lst,2))

The output:
    [1,2]
    [3,4,5,6]
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Ming