How can I find every nth element of a list?
For a list [1,2,3,4,5,6]
, returnNth(l,2)
should return [1,3,5]
and for a list ["dog", "cat", 3, "hamster", True]
, returnNth(u,2)
should return ['dog', 3, True]
. How can I do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…