Let say, I have a list:
[Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
and I randomly choose the index (let say idx=4, thus "May"), I want my function to return
[Mar,Apr,May,Jun,Jul]
If the index is 0 (Jan) or 1 (Feb) then I want my function to return [Jan,Feb,Mar,Apr,May]. The length of returned list is always 5.
How to create such function in Python3?
Simple question but why my head starts to explode?
Thanks.
Aucun commentaire:
Enregistrer un commentaire