how can i create a list from lager list and only 3 number position in to new list in Python
list = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)
Can it be like this?
list = (1,5,9,12,15,18,21)
>Solution :
First time contributing here but this will do it:
my_list = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]
new_list = []
for i in range(0, len(my_list) + 1, 3):
new_list.append(i)
print(new_list)