Categories
How is this done in ruby?
Which one can rewrite (python) 'hello world'[10:0:-2] to ruby?
Answer the question
In order to leave comments, you need to log in
It will not work in ruby as laconic as with Python's slice notation.
'hello world'.reverse.scan(/(.).{1}/).join => "drwol" 'hello world'.reverse.scan(/(.).{2}/).join => "doo"
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question