Write a program that return the first n numbers from a list


Topic: Write a program that return the first n numbers from a list

Solution

def sub_list(lst, ind):
    return lst[:ind]
print(sub_list([1, 2, 3, 4, 5, 56], 3))



List all Python Programs