Here is a string as an example.
s = 'asdf df d f d ssa'.
I need to get words at even indices from a string. For the above string s
, the words are:
1. 'asdf'
2. 'df' // Even index
3. 'd'
4. 'f' // Even index
5. 'd'
6. 'ssa' // Even index
A correct output would be
'df f ssa'
. I think I would do this with a slice.
How might I go about this?