n=[0]*365
hey everyone i have a question how i make a formula that makes my numbers in list specific first i need it to start whith number 4 then if if its higher than 6 it needs to restart from 0 it would look like this 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6… I have tried using n[3+1] and then making number 7 to 0 number 8 to 1 and 9 to 2 and so on. Also i have tried setting first n[0] to 4 and then making for loop which has n[i]=n[i]+1 and then doing like in the first one.
Advertisement
Answer
Start your range at 4 (incrementing by 1) and calculate module 7. For example:
list_ = [n % 7 for n in range(4, 366)]
Which gives:
[4,5,6,0,1,2,3,4,5,6,0 etc]